How to configure postfix to force From: field but leave Reply-To: alone

Solution 1:

Forcing the from address when postfix relays over smtp

/etc/postfix/main.cf:

smtp_header_checks = regexp:/etc/postfix/header_check

/etc/postfix/header_check:

/From:.*/ REPLACE From: [email protected]

Tested with:

mail -s test -a 'Reply-To: [email protected]' [email protected] <<< test

Header on client side:

From: [email protected]
Reply-To: [email protected]
To: <[email protected]>

In syslog you then see

Nov  1 17:20:50 huuu postfix/smtp[4716]: 1B65481FAB18: replace: header From: root@huuu (root): From: [email protected]