Postfix:How to redirect to another mail server an email from from a sender

expuser2008
expuser2008 used Ask the Experts™
on
Have Postfix 2.6.6 on RedHat  which is used as an internal mail relay server for all incoming emails to be relayed to our exchange server. We are relaying emails destined to our domain ( mydomain.com ) to our exchange mail server ( 10.10.0.1 ). This is done by /etc/postfix/transport containing "mydomain.com smtp:[10.10.01] ".
We also want to relay emails from a single email sender "sender@otherdomain"  to our exchange server at 10.10.0.1. How can we do this?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Software Engineer
Distinguished Expert 2018
Commented:
it can be done by using  smtpd_send_restrictions....
In main.cf add: a check_send_access clause to the head of the smtp_send_restrictions key.

smtpd_sender_restrictions = check_sender_access hash:/etc/postfix/sender_redirect <, original content>

the file /etc/postfix/sender_redirect should then contain a list of addresses like: (1 per line).
from_address@some.example.org redirect new_to_address@another.example.org
Adding lines like
badaddress@example.com REJECT
should block mail from that user,and
okaddress@example.com OK
Should allways be allowed

after that regenerate aliases etc.... (ie. postmap /etc/postfix/sender_redirect)

Author

Commented:
Thank you, it almost worked, but used in sender_redirect table " from_address@some.example.org FILTER smtp:10.10.0.1"
nociSoftware Engineer
Distinguished Expert 2018

Commented:
Ah, did it of the top of my head... long time ago i did postfix, so i need to do a refresher if i need it again.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial