I have a postfix based mail server that I need to configure to send mail for different domains using the same SMTP server but with different AUTH settings.
Example:
- mail from domain1.com should go out via smtp.gmail.com with username1@domain.com:PASSWORD1
- mail from domain2.com should go out via smtp.gmail.com with username2@domain.com:PASSWORD2 ... and so on.
I have this so far in my main.cf file:
sender_dependent_relayhost_maps = hash:/etc/postfix/relay_maps
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = encrypt
smtp_tls_note_starttls_offer = yes
And /etc/postfix/relay_maps:
@domain1.com [smtp.gmail.com]:587
@domain2.com [smtp.gmail.com]:587
And /etc/postfix/sasl_passwd:
[smtp.gmail.com]:587 user1@domain.com:PASSWORD1
[smtp.gmail.com]:587 user2@domain.com:PASSWORD2
But it does not work as expected and everything goes out using the first line of credentials from sasl_passwd
Basically what I can't figure out is how to make postfix differentiate which credentials set it should use for which domain.
Please help. THanks