Postfix server - Setup multiple relay hosts based on request IPaddress
by karthik-techie from LinuxQuestions.org on (#4TR08)
I am using postfix SMTP server. As per my requirement, Now I want to setup 2 SASL accounts to send mails through 2 relay hosts. Those are
1) user1@example.com - relayhost - sendgrid
2) user2@example.com - relayhost - local smtp server
Now, I am integrating
user1 account in website-1 user2 account in website-2 when the request came from website-1, mails should go from sendgrid and request came from website2 mails should go from local SMTP server(installed in server). I have done this setup with "transport" configuration(/etc/postfix/transport file). In transport configuration, we are giving domain names. Now, I want give IP address instead of domain names.
How we can route mapping by IP address?
It means, when request came from IP address 'X', mails should go from sendgrid and request came from IP address 'Y' mails should go from local SMTP server(installed in server). Please provide your suggestions to achieve this requirement. Thanks in advance.


1) user1@example.com - relayhost - sendgrid
2) user2@example.com - relayhost - local smtp server
Now, I am integrating
user1 account in website-1 user2 account in website-2 when the request came from website-1, mails should go from sendgrid and request came from website2 mails should go from local SMTP server(installed in server). I have done this setup with "transport" configuration(/etc/postfix/transport file). In transport configuration, we are giving domain names. Now, I want give IP address instead of domain names.
How we can route mapping by IP address?
It means, when request came from IP address 'X', mails should go from sendgrid and request came from IP address 'Y' mails should go from local SMTP server(installed in server). Please provide your suggestions to achieve this requirement. Thanks in advance.