I use RT as a problem-ticketing system (or at least, I encourage people to use it). Since I don’t manage my own mail server, I’ve been putting off the mail gateway part of this for a while, but finally got it working yesterday.
The mail handler is
rt-mailgate, and the basic setup is explained in the man page. In your
/etc/aliases file, add the line:
rt-email: "|/usr/bin/rt-mailgate --queue General --action correspond --url https://localhost/rtIf using exim, you also need to edit
exim4.conf.templateto include the line:
pipe_transport = address_pipesomewhere outside the SYSTEM_ALIASES_PIPE_TRANSPORT block. Run
update-exim4.confand restart exim.
More after the jump…
The first problem I encountered after this point was that I was getting a 401 Error from the webserver when I tried a test message from the command line. I use Kerberos/LDAP within my systems, and have RT set up to use Kerberos auth, so spent a while experimenting with that. Turns out it’s more straightforward than that: the mail stuff is within a section of RT entitled “NoAuth”, which means pretty much what it says on the tin. If you have some kind of authorisation for the RT website, you need to exclude the NoAuth sections from that. So the relevant section of your Apache 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 want to have here (mine is Kerberos) </Location>
After this it worked fine from the command line, so the final part was to set up a cronjob to run fetchmail appropriately (if you have your own mail server you can do this differently - e.g. set
/etc/aliases on the mailserver to direct straight to the webserver address). My fetchmail config looks like this:
poll mailserver.example.com protocol IMAP username rt-email password PWD smtpaddress example.com mda '/usr/bin/rt-mailgate --queue General --action correspond --url https://localhost/rt'and the
crontabline (run on the webserver) is:
*/2 * * * * root /usr/bin/fetchmail -f /etc/cron.d/rt-fetchmail.conf > /var/log/rtmail.log 2>&1
And that’s it - all works beautifully now.