1

I'm struggling to integrate Postfix with RT. I'm new to all this so I might be doing some dumb mistakes.

AFAIU, Postfix and RT integrate with a mapping between the RT queue and the recipient address in the /etc/alias file.

We have done this for two queues:

support:    "|/opt/rt4/bin/rt-mailgate --queue general --action correspond --url http://localhost" 
support-urgent "|/opt/rt4/bin/rt-mailgate --queue urgent --action correspond --url http://localhost"

So whenever an email is sent to support@company.com, it gets in queue general and whenever it is sent to support-urgent@company.com, it gets in the other queue.

However, we'd like to simplify the life of our customers by only communicating one single email address to them: support@company.com.

We'd then maintain a list of customers for whom we have a contract that gives them priority.

Basically, we'd need to do some conditional recipient rewriting based on a lookup on the sender address. If X@customerA.com is in our priority list, the recipient address should be changed to support-urgent@company.com for rt to pick it up in the right queue. If B@companyB.com is not on the list, then no rewriting would be necessary.

Is this simple to do or would I require a second Postfix instance on another port?

Thanks for any help or clues. Seb.

Ryan Babchishin
  • 6,160
  • 2
  • 16
  • 36
sebclaut
  • 21
  • 3

2 Answers2

2

RT has a full automation system called Scrips that allows you to add actions on every transaction on an RT ticket. Using this system, you could create a new scrip to "Change Queue Based on Sender". You can then write some action code to look at the requestors email address, consult some configuration that maps the "from" domain to your queues, then update the queue on the incoming ticket.

The RT community wiki has an example scrip that sets a queue automatically. In your case, you should be able to look at the Requestor object on the ticket since the ticket has already been created. The condition would be On Create.

Jim Brandt
  • 280
  • 1
  • 4
1

If you are familiar with Unix tools but not with Perl, you can also do this mail processing in procmail.

You need to add into your /etc/procmail/main.cf:

mailbox_command = procmail -a "$EXTENSION"

Example /etc/procmailrc:

:0
* ^From: .*<+X@customerA.com>+
* ^Subject:.*optional.*
| /opt/rt4/bin/rt-mailgate --action correspond --queue urgent --url http://localhost

You can use regular expressions to match the list of VIP users, or keep an whitelist in an external file

However, if you are going to deal with a lot of RT configuration, investing time on learning about Scrips may be a better option as Jim suggested.

morallo
  • 146
  • 3