-
Webseiten Hosting/Server Referenzen Kontakt/Impressum

How to route mails with Postfix based on the sender of the mail

<< Back to overview / Zurück zur Übersicht

Note: This information was written in the year 2005 - so it may be outdated!
The idea: Some big mailsystems reject mail that is not comming from the IP that correspondent with the IP of the domain's MX. But what if you want e.g. to send automatic mails from a system with another IP?
Needed
:
Postfix
It's very simple if the specific server is not accepting incoming (external) mail and only serves as a mail-forwarder (relayhost):
Add to your /etc/postfix/main.cf:
sender_based_routing = yes
Add to your transport-table (normally /etc/postfix/transport):
domain.tld smtp:[192.168.8.8]
* smtp:[192.168.9.9]
This will send all mail from domain.tld (sender-address!) to 192.168.8.8 (the square brackets disable MX/DNS lookups). All other mail will be sent via 192.168.9.9.
Enabling the sender_based_routing feature of postfix will affect some other things, so I don't recommend to use this feature on a normal in/out-server (e.g. it's no longer possible to use routing via the mail's recipient and the bouncing of mails is also affected).



Seite zuletzt geändert am: 18.11.2011