Hi I need to set up 2 or more SMTP relays in postfix for sending out mail from a java program. For example the servers would be [smtp.office365.com]:587 and [smtp.gmail.com]:587 and the send addresses "email1AToffice365.com" and "email2ATgmail.com" How would I setup these 2 relays working together? And how do I then tell which relay/send address to use? Currently I manage to send out mail from these accounts separately by plain authenticating in the java program to postfix with a linux user "linuxuser1ATmyserver.com". But with 2 relays and 2 send addresses I need to somehow tell which relay to use. The java program cannot directly interact with [smtp.office365.com]:587, thus it needs to use a relay.
Thank you. I've read that, but how do I tell which relay and send address to use? The java program authenticates to postfix as "linuxuser1ATmyserver.com"
I think reply #2 in that post provides solution in the second example. I never tested that though, so I do not know whether that works.
I think I may have got it working. Testing in the java webapp next main.cf: sender_dependent_relayhost_maps = hash:/etc/postfix/relayhosts relayhosts: mail1ATgmail.com [smtp.gmail.com]:587 mail2AToffice.com [smtp.office365.com]:587 Edit: Yes it also works in the java program