SendmailWithoutQueueAliases

From Request Tracker Wiki
Jump to navigation Jump to search

Lets say you want to be able to create new queues without having to touch your sendmail configuration. This how-to will allow you to send a mail to [=queuename@rt.example.com] to Correspond to tickets, and [=queuename+action-action-action@rt.example.com] to work those tickets via email You will need to set [=Set($UnsafeEmailCommands,1);] in your RT_SiteConfig.pm if you wish to take full advantage of this. Read the perldoc documentation of rt-mailgate for full details on using EXTENSION with rt-mailgate.

This howto assumes you have a dedicatd domain for RT configured in sendmail. We'll use rt.example.com.

  • First add a rt3 user to receive all mail directed to RT. This is so we can have a custom .procmailrc for RT.
adduser rt3 -g rt3
  • In /etc/mail/virtusertable add the following lines:
@rt.example.com     rt3+%1
+*@rt.example.com   rt3+%1.%2
  • Rebuild your map files in /etc/mail
make -C /etc/mail

These virtusertable entries redirect all mail for the domain rt.example.com to the rt3 user. Using "plushack" (known here as EXTENSION) we can tell rt-mailgate what queue we're working with. As a bonus, we use a period as a delimiter on the back-end for separating the queue name from the list of actions. End users won't see the period in email addresses, nor should they use them.

  • Create a .procmailrc in the rt3 user's homedirectory containing the following:
# Uncomment VERBOSE and LOGFILE for debugging, they're helpful at times.
 #VERBOSE=1
 #LOGFILE=$HOME/.procmail.log
 LOCKFILE=$HOME/.procmail.LCK
 ARG1=$1
 EXTENSION=`echo $ARG1 | awk -F. '{ print $1 }'`
 SUFFIX=`echo $ARG1 | awk -F. '{ print $2 }'`
 
 
 # if no list of actions, default action is correspond
 :0
 * ? test -z "$SUFFIX"
 |/opt/rt3/bin/rt-mailgate --extension queue --action correspond --url http://rt.example.com/
 
 # Otherwise, if we DO have a list of actions, run with them.
 :0 E
 * ? test ! -z "$SUFFIX"
 {
   :0
   |/opt/rt3/bin/rt-mailgate --extension queue --action $SUFFIX --url http://rt.cexample.com/
 }
 
  • Notes

Configure your RT_SiteConfig.pm Set($rtname,'rt.example.com');, Set($Organization,'rt.example.com'); and your [=Set($RTAddressRegexp,'@rt\.example\.com$');] to the same catch-all domain in virtusertable. I also turn on [=Set($ParseNewMessageForTicketCcs,1);] so that RT auto-assigns people in the To:/Cc: address fields when someone opens a ticket via e-mail.

  • BUGS

Mail sent to aqueuethatdoesntexist@rt.example.com will vanish, without an answer.