Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

It's known that users can provide any email in From: field. I need to prevent it by rewriting it to email used in authorization procedure. Is it possible to do in postfix? Or may be other MTA?

share|improve this question

Yes smtpd_sender_restrictions to include reject_sender_login_mismatch or reject_authenticated_sender_login_mismatch along with any other restrictions you put in place (order does matter).

The table doesn't have to be hash and probably shouldn't be. If your setup is rather simple you will want PCRE or regex. More complicated setups use ldap, mysql,PostgreSQL or SQLite.

You can also mix and match, but do so with caution and proper testing postmap -q.

Depending how your clients are setup you may need to set smtpd_sasl_local_domain.

Additional examples:

share|improve this answer
Yes, it is better do REJECT a bad sender instead of rewriting it to a good one. – mailq Aug 7 '12 at 20:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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