Request Tracker is an enterprise grade ticketing system developed by Best Practical. RT is used by Fortune 100 companies, government agencies, educational institutions, and development organizations worldwide. Many implementations of RT run behind the Postfix mail-server.
The RT wiki has instructions on setting up your MTA to ‘pipe’ the e-mails into RT:
You need to tell your Mail Transfer Agent (ex sendmail, postfix, or qmail) how to forward messages to RT’s mail gateway. To do this, create an aliases in your system’s mail aliases file. Here’s an example, which routes mail to the mailbox [=rt@example.com] (and [=rt-comment@example.com]) into new tickets in the RT queue named General. Note that the queue name is case-insensitive.
Add the following lines to /etc/aliases (or your local equivalent such as /etc/mail/aliases):
rt: “|/opt/rt3/bin/rt-mailgate –queue general –action correspond –url http://localhost/rt”
rt-comment: “|/opt/rt3/bin/rt-mailgate –queue general –action comment –url http://localhost/rt”
These instructions are accurate, but rely on Postfix not having implemented Virtual Domains. Here’s an example configurationfrom main.cf where virtual domains have been implemented:
virtual_transport = virtual
virtual_uid_maps = static:5000
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
This configuration will invoke the virtual transport within Postfix. A virtual transport is unable to perform the necessary pipe (”|”) to the rt-mailgate binary. Only the local transport is able to perform a pipe. So, the question is: how do we run virtual domain(s), but still invoke the local transport delivery method to successfully perform the pipe into rt-mailgate?
A Virtual to Local Rewrite Solution
Here’s a quick walkthrough on what steps you need to put in place to ensure that a mail to the (virtual) domain of rt-test@domain.tld is successfully piped as per the RT wiki instructions above.
- Create an /etc/postfix/aliases file.
- Within this file add entries that follow this format:
rt-test rt@rt.domain.tld support support@rt.domain.tld abuse abuse@rt.domain.tld # and so on...
- postmap /etc/postfix/aliases
- Within /etc/aliases create the pipe aliases referred to in the RT wiki:
support: "|/opt/rt3/bin/rt-mailgate --queue 'Support' --action \ correspond --url http://rt.domain.tld/" rt: "|/opt/bin/rt-mailgate --queue 'General' --action \ correspond --url http://rt.domain.tld/" abuse: "|/opt/rt3/bin/rt-mailgate --queue 'Abuse' --action \ correspond --url http://rt.domain.tld/" # Ensure there are no line breaks..
- Run the newaliases command.
- Insert the appropriate configuration amendments to main.cf
# To ensure local delivery, rt.domain.tld must be added to # $mydestination mydestination = localhost localhost.localdomain rt.domain.tld # /etc/postfix/aliases is added: virtual_alias_maps = hash:/etc/postfix/aliases mysql:/etc/postfix/mysql_virtual_alias_maps.cf # alias_maps is what is READ by delivery agents etc. alias_maps = hash:/etc/aliases # alias_databases is what is WRITTEN by newaliases alias_database = hash:/etc/aliases # masquerade as @rt.example.com unless also on this list,never root masquerade_domains = rt.domain.tld masquerade_exceptions = root
- Save the file, then reload Postfix’s configuration: /etc/init.d/postfix reload
- Send an e-mail to support@domain.tld and observe Postfix working its wonders..
Aug 19 21:12:18 solo postfix/local[2972]: 2B91710EB92: to=<support @rt.domain.tld>, orig_to=<support@cjbuckley.net>, relay=local, delay=17, delays=17/0.05/0/0.54, dsn=2.0.0, status=sent (delivered to command: /opt/rt3/bin/rt-mailgate –queue ‘Support’ –action correspond –url http://rt.domain.tld/)
I wrote this article mainly because I see the question oft repeated on the Postfix Users Mailing List. Any comments and (especially) improvements welcome.
August 19, 2007



















Horaayy..there are 4 comment(s) for me so far ;)
Hi Chris,
Current RT comes with Postfix 2.2.9, if I were to upgrade to version 2.5.2, do I believe I will need to uninstall. However the next question is will uninstalling the old postfix causes an impact to RT? Any idea?
Hi Fabian,
Going between postfix versions *should* have no impact. Crucially, the way aliases are handled has not been changed. I went from postfix 2.2.x to 2.5.1 with no incident.
As always, testing in a development environment before rolling changes to production is heavily encouraged.
HTH!
All the best,
Chris
Chris,
Your instructions pointed me in the right direction, but I believe your /etc/postfix/aliases file listing is backwards. The files normally have the first column as the matching criteria, and the second column as the destination. I could not get it to work until I reversed the order of your file, so that the full address(rt@domain.tld) is first and the destination alias (rt) is second.
I\’m assuming the config works for you, but for some reason mine would not until I made this change. Hopefully this will help save someone else the frustration (and hair loss!)
Jeremy
Hi Jeremy,
This probably has to do with the way my postfix aliases is set up.
What do you have in main.cf?
I have checked mine and I have:
virtual_alias_maps = hash:/etc/postfix/aliases proxy:mysql:/etc/postfix/mysql_virtual_alias_maps.cf
Within my /etc/postfix/aliases I also have:
apache@cjbuckley.com apache
apache@cjbuckley.net apache
support@cjbuckley.net support@rt.cjbuckley.com
rt-test rt@rt.cjbuckley.com
support support@rt.cjbuckley.com
So I have a mix and match - all which work.