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 firstname.lastname@example.org, when google rewrites the envelope_recipient the message will be turned into OU1email@example.com. The issue is that the "To: Helpdesk <firstname.lastname@example.org>" 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 OU1email@example.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 <firstname.lastname@example.org>" in a message to be something else such as "To: Helpdesk <OU1email@example.com>" based on the envelope_recipient which would be OU1firstname.lastname@example.org.