This PHP based mail2trac script reads from a POP3 or IMAP mailbox and imports messages as Tickets with Attachments. It is designed to be run via cron on some periodic basis.
Overview
The mail2trac system is designed to be run via cron or some other command scheduler to attach to a mailbox, pull message, create tickets, delete the messages and close the connection. It will only process one mailbox at a time, then exit. To collect from multiple mailboxes simply run multiple commands. Or configure SMTP routing to get all the necessary mesages in a single mailbox.
Features
While small, mail2trac delivers some nifty features.
- Minimal Dependencies / Requirements
- Simple IMAP/IMAPS/POP3/POP3S access, no special MTA configuration required
- Simple Configuration, call directly from cron, shell or even as web-page
- Run from almost any host, only needs HTTP(S) access to Trac
We also have this list of non-features, things we don't do
- Multiple Accounts & Configs (WIP)
- Replies to the mailbox are not added as updates to existing tickets, long story. We're working on this
Requirements
The mail2trac.php script is written for PHP 5.3 or newer and requires the IMAP extensions. The Trac system must be at least 0.11 and have the XML-RPC plugin.
- Install and have the PHP CLI available, with IMAP extensions, see
php -i
- Install Trac Hacks - XML RPC to your Trac system
Now install this script with the following, adjust to your environment
root@host # mkdir -p /opt/edoceo/bin; cd /opt/edoceo/bin root@host # wget http://edoceo.com/bin/mail2trac.php root@host # chmod 0755 mail2trac.php
Create a configuration file
; Fetch POP3 Mail host = "{imap.gmail.com:995/ssl/serivce=pop3}INBOX" ; Fetch IMAP Mail over SSL ;host = "{imap.gmail.com:993/ssl}INBOX" user = "help@domain.tld" pass = "secret" trac = "http://user:pass@host/trac/login/rpc"
Tickets will be automatically created in Trac with defaults. We suggest creating a default milestone of Active Queue for triage. We are also available for assistance on this or other Trac related issues, just contact us.