Configure sendmail to use external smtp with authentication
Posted: Tue Jul 11, 2006 6:06 pm
If you are using sendmail only to transfer e-mail from your local computer to a mail server that requires SMTP AUTH, follow these instructions. They assume that sendmail 8.12 or later, and other software, is already installed on your computer. You should probably be logged in as root to perform these steps.
1. Change directory to where your sendmail configuration files (sendmail.mc and sendmail.cf) are located, usually /etc/mail/.
2. Create a safe subdirectory (suggested name auth/):
# mkdir auth
# chmod 700 auth
3. Create a file with your authentication information (suggested name auth/client-info):
AuthInfo:your.isp.net "U:root" "I:user" "P:password"
filling in your ISP's mail server, your user name, and your password. (Note: Earthlink, and perhaps other ISP's, requires your full e-mail address as a user name.)
4. Generate the authentication database and make both files readable only by root:
# cd auth
# makemap hash client-info < client-info
# chmod 600 client-info*
# cd ..
5. Add the following lines to your sendmail.mc file, filling in your ISP's mail server:
define(`SMART_HOST',`your.isp.net')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
FEATURE(`authinfo',`hash /etc/mail/auth/client-info')dnl
6. Generate sendmail.cf:
# m4 sendmail.mc > sendmail.cf
7. Restart the sendmail daemon, e.g., (this depends on your OS):
# kill -HUP `cat /var/run/sendmail.pid`
Note: if FEATURE(`authinfo') is used, then the hostname in the map entry must match exactly the hostname of the ISP mailserver as explained in cf/README: Note: searches for domain parts or IP nets are only performed if the access map is used; if the authinfo feature is used then only up to three lookups are performed (two exact matches, one default).
(This was written by Benji Fisher. Thanks!)
1. Change directory to where your sendmail configuration files (sendmail.mc and sendmail.cf) are located, usually /etc/mail/.
2. Create a safe subdirectory (suggested name auth/):
# mkdir auth
# chmod 700 auth
3. Create a file with your authentication information (suggested name auth/client-info):
AuthInfo:your.isp.net "U:root" "I:user" "P:password"
filling in your ISP's mail server, your user name, and your password. (Note: Earthlink, and perhaps other ISP's, requires your full e-mail address as a user name.)
4. Generate the authentication database and make both files readable only by root:
# cd auth
# makemap hash client-info < client-info
# chmod 600 client-info*
# cd ..
5. Add the following lines to your sendmail.mc file, filling in your ISP's mail server:
define(`SMART_HOST',`your.isp.net')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
FEATURE(`authinfo',`hash /etc/mail/auth/client-info')dnl
6. Generate sendmail.cf:
# m4 sendmail.mc > sendmail.cf
7. Restart the sendmail daemon, e.g., (this depends on your OS):
# kill -HUP `cat /var/run/sendmail.pid`
Note: if FEATURE(`authinfo') is used, then the hostname in the map entry must match exactly the hostname of the ISP mailserver as explained in cf/README: Note: searches for domain parts or IP nets are only performed if the access map is used; if the authinfo feature is used then only up to three lookups are performed (two exact matches, one default).
(This was written by Benji Fisher. Thanks!)