@
you're reading...
Email Servers, Linux Tips and Tricks

Route Mail to other SMTP based on the Sender

We are currently migrating Mail Restriction from Linux System to Exchange but we have to do it by batch so as to limit the effect if in case something might not go as planned. With that said, we have identified the users to be migrated but the problem is that we can’t relay mails to our Exchange servers.

We have tried checking on the sender_dependent_relayhost_maps and related config but no to avail.

However, to my surprise and what worked for us is that utilizing smtpd_sender_restrictions. Below is what I have done for our setup:

Add a line below under smtpd_sender_restrictions:
smtpd_sender_restrictions =
check_sender_access hash:/etc/postfix/for_migration

And I have this on my /etc/postfix/for_migration file and postmap this file and restared postfix.
yongitz.testme@ FILTER relay:[192.168.1.9]

With this, when the user yongitz.testme sends an email, local postfix does not queue the mail but instead relays it to our Exchange Server(192.168.1.9).

I actually have tried this using header_checks but seems to be inconsistent and since this works, I am happy with it as we can now go on with the migration.

Advertisements

Discussion

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s