Problem
How to setup a Mail Relay in sendmail?
How to setup a SMTP Mail Relay in sendmail?
Solution
Follow the guide below to configure sendmail to use outMail as a Internet Mail Relay.
This article is written for sendmail version 8.11+ and although tested on Centos6, should be applicable for other distributions.
It already assumes your server has sendmail 8.11+ installed already, it has correctly configured access to the Internet and you have a terminal connection to your server with the necessary access rights to manage and administer sendmail.
You need to edit the /etc/mail/sendmail.mc file.
There should be a line like below:
dnl define(`SMART_HOST', `smtp.your.provider')dnl
The dnl stands for 'delete till new line' and so effectively comments out the whole line. Remove the FIRST 'dnl' and space and replace the 'smtp.your.provider' with the Outmail server you were sent when you signed up. The line should look like:
define(`SMART_HOST', `mx??????.smtp-engine.com')dnl
NOTE - strings in this file are started with the 'backtick' character ( ` ) and ended with the apostrophe character ( ' )
We now need to setup the authentication.
Further down the file, there are a number of lines starting with FEATURE( , we need to add a new line immediately after these that looks like: (remember to check the ` and ' )
FEATURE(`authinfo')dnl
Save the file.
Now create a new file called /etc/mail/authinfo containing the following line (replace mx??????, USERNAME and PASSWORD with the case-sensitive credentials you were provided with):
AuthInfo:mx??????.smtp-engine.com "U:USERNAME" "P:PASSWORD"
Make sure that the hostname matches that in the sendmail.mc file
If you don't have sendmail-cf installed, install it using:-
yum install sendmail-cf
Now you can rebuild the sendmail configuration with
make -C /etc/mail
Summary of server details
Outgoing server |
mxXXXXXX.smtp-engine.com As provided in your signup email. |
Outgoing server protocol |
SMTP |
Outgoing server port |
25, 465, 587, 2525 or 8025 |
Authentication Type |
Basic Authentication, SSL and TLS supported |
Username |
As provided |
Password |
As provided |
Uninstalling / Removing outMail
To change your outgoing SMTP server settings away from outMail simply follow the setup guide above and where asked to enter the outgoing SMTP mail server address and login credentials please use those provided to you for the service provider you are moving to.