Link to home
Start Free TrialLog in
Avatar of CoryInIT
CoryInITFlag for United States of America

asked on

Postfix To: address rewrite based on envelope_recipient

I'm trying to setup e-mail aliasing for a helpdesk software (Absolute Service).  The theory is that each sender OU translates into a different alias which is then sent to a common account so that the helpdesk software can retrieve the message and assign it to the correct team based on the aliase it was sent to.   For each OU in my google apps domain I am rewriting the envelope_recipient to route the message to an alias which identifies the senders OU.  

For example.  A sender in OU1 will write a message to helpdesk@domain.com, when google rewrites the envelope_recipient the message will be turned into OU1-helpdesk@domain.com.  The issue is that the "To: Helpdesk <helpdesk@domain.com>" doesn't change on the message and this is the part that the helpdesk software is looking at to determine the appropriate team to assign the automatically created ticket.

My thoughts were to go one step further and rewrite the envelope_recipient to be OU1-helpdesk@localserver.domain.com and then have postfix rewrite the "To:" field but this has proved more difficult than I anticipated since postfix will only search and replace in the same header line.

I need postfix or something else to rewrite "To: Helpdesk <heldpesk@primary.com>" in a message to be something else such as "To: Helpdesk <OU1-helpdesk@primary.com>" based on the envelope_recipient which would be OU1-helpdesk@primary.com.
Avatar of gheist
gheist
Flag of Belgium image

Modifyind message content is bad. There is no limit in body to: fields, What do you do with message with 30 cc: fields 30 reply-to and 30 to: fields but 3 envelope recipients?
ASKER CERTIFIED SOLUTION
Avatar of CoryInIT
CoryInIT
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CoryInIT

ASKER

The result is a email which goes to the helpdesk@domain.com account with the appropriate aliase in the To: field of OU-helpdesk@domain.com.  This way our helpdesk software will assign the ticket created from this e-mail to the correct service team.