Hi I have smtp server on a local network and all other local machines send emails through this one (mastersmtp.lo.cal

I need to rewrite all TO/destination address from test1.lo.cal ( and abrakadabra.lo.cal ( servers, which relay to my mastersmtp.lo.cal.

I think this should be done on mastersmtp.lo.cal. it uses postfix as mail software.

Maybe someone knows any most "default"/simple way of doing this?

Thank you.

1 Answer 1


used http://www.postfix.org/header_checks.5.html

added to main.cf:

# for redirection some emails
  header_checks = pcre:/etc/postfix/header_checks

content of: /etc/postfix/header_checks

/^From: (.*@test1.lo.cal)/ REDIRECT [email protected]
/^Received: (.* REDIRECT [email protected]
/^From: (.*@abrakadabra.lo.cal)/ REDIRECT [email protected]
/^Received: (.* REDIRECT [email protected]

reload restart and so on :) as always :)

postmap -q - pcre:/etc/postfix/header_checks < /etc/postfix/header_check
systemctl reload postfix

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .