Rewriting to address on postfix local aliases

Posted by Wade Williams on Server Fault See other posts from Server Fault or by Wade Williams
Published on 2012-06-27T20:41:17Z Indexed on 2012/06/27 21:19 UTC
Read the original article Hit count: 300

Filed under:
|
|

I was running into the common problem that mail for "root" on my system was having $mydomain appended, and because $mydomain is not in $mydestination, the mail was being sent to our central mail server as "root@domain."

I cannot add $mydomain to $mydestination, because if I understand it correctly, that would mean all mail addressed to $mydomain would be looked up locally, and if an alias does not exist, delivery would fail.

So, I followed these instructions:

Delivering some, but not all accounts locally

which seems to have resolved the problem. Mail for "root" is now expanded according to /etc/aliases and delivered to the non-local address I desire. The one oddity however is that the "To:" address still reads "root@domain." Is there any way I can get the "To" address to be the one that the alias directed its delivery? So for example, if my alias says that mail for "root" should go to "hostname-admin@domain" is there any way the "To" address can be rewritten as "hostname-admin@domain?" Currently it still shows as "root@domain."

© Server Fault or respective owner

Related posts about email

Related posts about postfix