I recently changed the MPA on my server from sendmail to postfix. The only problem I had was configuring my mail relay -- my relay requires me to log in. How to do this in postfix? The answer is not obvious and not explained. In coming SMTP connections are covered extensivily but not out going.
After many hours of Googling, I came across Daniel Mettler's Postfix outgoing/outbound SMTP authentication for smtp.hispeed.ch/cablecom.c . Here he gives the secret which I shamelessly copy here for my own future edification.
Add to your /etc/postfix/main.cf
file:
relayhost = mail.your-relay.net smtp_sasl_auth_enable = yes smtp_sasl_mechanism_filter = plain smtp_use_tls = no smtp_sasl_password_maps = hash:/etc/postfix/sasl_password_outgoing_smtp smtp_sasl_security_options = noanonymouswhere
mail.your-relay.net
is the name of your relay host computer.
This instructs that the mail relay is using sasl logins and the credentials are in the
specified file.
Then, create /etc/postfix/sasl_password_outgoing_smtp
containing:
mail.your-relay.net login:passwordwhere
mail.your-relay.net
is your relay host,
login
is your login account name and
password
is the password for your account.
Then, has the file (creates
/etc/postfix/sasl_password_outgoing_smtp.db
)
and have postfix reload it's parameters:
/usr/sbin/posthash /etc/postfix/sasl_password_outgoing_smtp /usr/sbin/postfix reload
Viola, it works!!