Sendmail 8.x SMTP Mail Transfer Agent for Linux and Unix - Setup Guide
Important Points
- This instructions will guide you through configuring Sendmail to use AuthSMTP as an authenticated smart host for all your outbound email
- First you need to make sure the email addresses you will be sending from have been authorised on your account in our Control Panel
- These instructions assume your server is already configured with Sendmail, email can be received and you have external network access on one of the following ports - 23, 25, 26, 325, 2525
- Backup your Sendmail configuration files before making any changes.
- These instructions are only for the Sendmail Mail Transfer Agent, they are based on Sendmail version 8.13 installed on a Linux platform but will loosely apply to many other versions and platforms providing it is recent and has support for Cyrus SASL compiled in - for other email programs please see How To Setup AuthSMTP or contact us.
This is only intended as a basic guide to setting up AuthSMTP and assumes prior knowledge of Linux / Unix system administration, we CANNOT provide support on general usage of the operating system or on implementing more complex configurations - for additional support with the MTA please use the software vendors support channels.
SASL Support
To use Sendmail with your AuthSMTP account, your Sendmail installation needs to have support for SASL compiled in.
SOLARIS: The default installation of Sendmail on Solaris 10 / 11 has *not* been built with support for SASL which is required for SMTP authentication. To use Sendmail on Solaris with our service you will need to compile Sendmail from sources and configure support for SASL as part of the build.
FREEBSD: The default installation of Sendmail on FreeBSD 9 / 10 /11 has *not* been built with support for SASL. The best option is to build Sendmail from the ports (/usr/ports/mail/sendmail*) and enable SASL support.
You can test if you have support for SASL installed by running the command 'sendmail -bt -d0.1 < /dev/null' and you should see 'SASLv2' listed in the results.
If you are unable to install the additional SASL support for Sendmail, the alternative is to install a different MTA such as Postfix using the packages available from the Postfix website, we have a setup guide for configuring SMTP authentication with Postfix .
Instructions
- Login to your server on a command line as 'root' via SSH etc
- Move to your Sendmail configuration directory (typically /etc/mail)
>cd /etc/mail
- Backup your configuration files:
>mkdir /SENDMAIL_BACKUP >cp /etc/mail/* /SENDMAIL_BACKUP
- Open your Sendmail configuration file (typically /etc/mail/sendmail.mc) using 'vi' or an alternative file editor and find the line that reads:
dnl define(`SMART_HOST', `smtp.your.provider')dnl
- Change this to the following ensuring you remove 'dnl' from the beginning of the line:
define(`SMART_HOST', `mail.authsmtp.com')dnl
- On the line below that add the following line:
FEATURE(`authinfo', `hash -o /etc/mail/authinfo')dnl
- This step is optional - the default SMTP port is 25 but some ISPs block this port so if you wish to use one of the alternative ports (23, 26, 2525) please add the following line below the two previous lines you added.
define(`RELAY_MAILER_ARGS', `TCP $h 2525')dnl
- Save and close the file.
- To disable SSL / TLS connections (not recommended) open the file /etc/mail/access using 'vi' or an alternative file editor and add the following line:
Try_TLS:mail.authsmtp.com NO
- Save and close the file.
- Next open the file /etc/mail/authinfo using 'vi' or an alternative file editor and add the following line:
AuthInfo:mail.authsmtp.com "U:acxxxx" "P:xxxx" "M:CRAM-MD5 DIGEST-MD5"
- 'U:' and 'P:' will need to be changed to use your AuthSMTP username and password accordingly.
- If you do not have support for CRAM-MD5 or DIGEST-MD5 installed on your server please change "M:CRAM-MD5 DIGEST-MD5" to "M:PLAIN"
- Save and close the file, run the following commands:
>makemap hash /etc/mail/authinfo < /etc/mail/authinfo >make -C /etc/mail >service sendmail restart
- The setup is now complete, please try sending a test message to ensure everything works okay, for trouble shooting you can:
- View sent messages and errors logged on your account by logging into the Control Panel.
- View sent messages and errors in your server log, typically Sendmail will log to:
/var/log/maillog
- Enable verbose logging in Sendmail by entering 'O LogLevel=9' in your sendmail.cf file and then restart Sendmail, this will log extra details to your default mail log.
Are you using Sendmail on an Amazon EC2 instance?
Please see - How do I change the hostname and from address on my Amazon EC2 instance when using AuthSMTP?