Instructions for updating the Sendmail configuration to use MailChannels as a relay host are provided in this article. Authentication with MailChannels is required and is relatively simple to setup.
Note: Sendmail requires libsasl in order to properly send authentication requests to MailChannels servers. The saslauthd server daemon is not required unless you plan to receive authentication requests to the same server. For more information on configuring Sendmail, see the Sendmail SASL support page.
Sendmail stores SMTP authentication credentials in /etc/mail/access. Add the provided line of code to the file, or edit an existing authentication line if there is already one present, replacing MailChannelsSMTPUsername with the SMTP username we provided you in the activation email. Replace MailChannelsSMTPPassword with one of the SMTP passwords you generated in the MailChannels Customer Console.
AuthInfo:smtp.mailchannels.net "U:MailChannelsSMTPUsername" "P:MailChannelsSMTPPassword" "M:PLAIN"
Do not use your MailChannels Customer Console user name in the Sendmail configuration. The MailChannels Customer Console user name is different than the MailChannels Cloud authentication user name that you will specify in /etc/mail/access.
Define Smart Host
This section sets up MailChannels Cloud as the smart host to relay all outbound emails. You should add code lines 1,3, and 4 around line 2 as shown below by editing /etc/mail/sendmail.mc.
define(`SMART_HOST', `smtp.mailchannels.net')dnl FEATURE(`access_db')dnl
define(`RELAY_MAILER_ARGS', `TCP $h 25')dnl define(`ESMTP_MAILER_ARGS', `TCP $h 25')dnl
Be sure to comment out the FEATURE(`access_db', , `skip')dnl line in the file as shown below.
# FEATURE(`access_db', , `skip')dnl
An authenticated sender header is required to track sender reputation within the MailChannels system. To add the authenticated sender header to outgoing emails, append the following line of code just before the MAILER DEFINITIONS section in /etc/mail/sendmail.mc.
X-AuthUser headers will be added only if the users are authenticated. When there are no headers, MailChannels Cloud treats these as forwarded mails so different policies are applied.
Updating sendmail.cf and access.db files
You must run these commands as a super user (su) or root. This is required to ensure that the changes are compiled and added to the Sendmail configuration files.
$ cd /etc/mail
$ m4 sendmail.mc >sendmail.cf
$ makemap hash access < access
On older distributions, you can restart Sendmail with the following command:
$ /etc/init.d/sendmail restart
If you are using a newer version, type the following to restart:
$ service sendmail restart