Is it possible to configure SMTP authentication on Postfix with different user/pass credentials for different domains?
So, I have a MTA that relays emails from ~20 different domains. When sending emails to a specific domain, say example.com, my MTA has to authenticate. No problem, this solved the problem:
http://postfix.state-of-mind.de/patrick.koetter/smtpauth/smtp_auth_mailservers.html
But, I have a different account for every sender domain. So, when mydomain1.com sends email to example.com, it uses one account. Another one for mydomain2.com -> example.com etc.
Is this achievable through Postfix?
Best Answer
You should read up a bit on this option: smtp_sender_dependent_authentication, with that, and two other related DB mappings,
sender_dependent_relayhost_maps
, andsmtp_sasl_password_maps
, you can create per sender password entries.In the
sender_dependent_relayhost
maps, you mapusername@domain [smtp_host]
, and in thesmtp_sasl_password maps
, you mapemail user:password
ordomain user:password
(whatever those might be). These are classic postfix lookup tables, they can be in mysql, dbm, hash, etc.With a combination of mysql and some duplication, you could quite possibly do what you want.
You could make a table with 4 fields,
email
,smtp_relay
,user
,password
, then have postfix look up the email and smtp_relay for thesender_dependent_relay_maps
, thenemail user:password
forsmtp_sasl_password_maps
. This would have to be populated with each email address that has to relay, each server that you relay through, and each user:password combo for the authentication.