I use RT as a request/bug tracker, but until recently hadn’t set it up with an email address plugged directly into it. This was because I don’t run my own email server - that’s centralised - which makes setup a bit more difficult. And undocumented, hence this post. Convincing users to use a different email address may well be tough, but at least you yourself can start bouncing relevant emails to the RT address, thereby creating a more trackable system.

There are 2 basic steps: 1. setting up the mail gateway to RT; 2. mail pickup from the external central server. Note that I’m using exim4 - other mail programs will obviously work differently. Details are below…

Mail gateway

As per the documentation, edit /etc/aliases to include the line

rt-email: "|/usr/bin/rt-mailgate --queue General --action correspond --url https://localhost/rt"
Then edit /etc/exim4/exim4.conf.template to include the line
pipe_transport = address_pipe
Note that this needs to be outside the SYSTEM_ALIASES_PIPE_TRANSPORT block. Reload exim4 for the change to take effect.

If you have any authorisation set up for RT access, you run into a problem here, which is that the mail server doesn’t have that authorisation. For this reason, there are sections of RT which are identified as NoAuth - you should turn authorisation off for those bits. The relevant section of your Apache2 config should look a bit like this:

    <Location /rt/NoAuth>
    Order allow,deny
    Allow from all
    Satisfy any
    </Location>

    <Location /rt/REST/1.0/NoAuth>
    Order allow,deny
    Allow from all
    Satisfy any
    </Location>

    <Location /rt>
    # whatever auth you have in place - Kerberos for me.
    </Location>
(thanks to this RT howto for this).

To test all of this, try:

cat testfile |/usr/bin/rt-mailgate --queue General --action correspond --url https://localhost/rt
and then try sending an email to your rt-email address from the local command line.

Picking up mail from the central server

The next step, then, is to grab the mail from the server and deal with it correctly. I use fetchmail for this, with the following config:

poll imap.example.com protocol IMAP username rt-email password passwd smtpaddress example.com
mda '/usr/bin/rt-mailgate --queue General --action correspond --url https://localhost/rt'
(that’s 2 separate lines, there). imap.example.com is whatever email server you use; example.com is whatever domain your email appears to come from.

The command to make this happen is:

fetchmail -f /root/rt-fetchmail.conf
which you will probably want to put in an appropriate crontab.

Email rt-email from somewhere non-local. Wait for the cronjob to run. Marvel! as a shiny brand new ticket appears in RT.