We are looking to send emails that are going out from development box to an email address based on the from address.

If they have the following from


We want to switch the to address to something like

  • 1
    You're going to need a policy daemon or a milter for that, I think. – Bill Weiss Oct 23 '09 at 20:01
  • Or you could do something clever like have mail from those addresses sent to a second instance of the smtpd, which redirects everything to devgroup@ . That's probably really complicated. – Bill Weiss Oct 23 '09 at 20:02

There's a map for that. ;) (apologies to Steve Jobs and Wietse Venema for my lame humour)

Postfix is capable of address rewriting under MANY circumstances. This circumstance would call for the use of the smtpd_sender_restrictions variable in main.cf.

Effectively, you will be putting a restriction in place to check sender addresses against an access table/db (the map!) you configure, wherein you will tell postfix to redirect to X address if the from address matches Y.

The line in main.cf might look like:

smtpd_sender_restrictions = check_sender_access hash:/etc/postfix/devToRewrite

And the contents of /etc/postfix/devToRewrite might look like:

sales@domain.com REDIRECT devgroup@domain.com

Please keep in mind that rewriting in postfix is very delicate, and you may have configs that could potentially conflict with these intended results.

That being said, some reading to get you started:

As usual, YMMV && HTH.


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.