I have recently been setting up a website for a friend. As part of this process I needed to sort out my mail server so that he could have a pretty email address.
For a long time I’ve been able to receive/access email to accounts on that server, but I’ve never configured it to allow sending via those accounts.
Setting this up took a few evenings of internet research. I found many old posts, most of them relating to old versions of sendmail. These seemed to need additional configuration, often involving SASL and/or cyrus.
My server is running CentOS 6, so sendmail is at version 8.12. It was in such a state that I started by uninstalling email services (
postfix) and reinstalling just sendmail (also
sendmail-cf). It seems that SASL2 is already installed. Cyrus is unused.
The interesting lines from
sendmail.mc are as follows:
define(`confAUTH_OPTIONS', `A p')dnl TRUST_AUTH_MECH(`LOGIN PLAIN')dnl define(`confAUTH_MECHANISMS', `LOGIN PLAIN')dnl define(`confCACERT_PATH', `/etc/pki/tls/certs')dnl define(`confCACERT', `/etc/pki/tls/certs/ca-bundle.crt')dnl define(`confSERVER_CERT', `/etc/pki/tls/certs/server-cert.pem')dnl define(`confSERVER_KEY', `/etc/pki/tls/certs/server-key.pem')dnl DAEMON_OPTIONS(`Port=smtp, Name=MTA')dnl DAEMON_OPTIONS(`Port=submission, Name=MSA, M=Ea')dnl MASQUERADE_DOMAIN(channel-e.co.uk)dnl MASQUERADE_DOMAIN(domain-two.co.uk)dnl MASQUERADE_DOMAIN(domain-three.co.uk)dnl MAILER(smtp)dnl MAILER(procmail)dnl
Of note are the authentication mechanisms. The default install lists many and it wasn’t until I reduced the list to the two shown that I was able to log in to send email. I masquerade all of the domains that users need to send from.
Don’t forget to enable ports through the firewall too.