Follow the guide below to configure Sendmail to use SocketLabs as the Smart Host and Internet Mail Relay
- Login to your server via SSH
- Sudo to superuser
- Navigate to your Sendmail configuration directory. This config file is typically found at /etc/mail. We recommend making backups of each configuration file before making changes.
sudo su
cd /etc/mail
mv sendmail.mc sendmail_backup.mc
- Edit Sendmail configuration file /etc/mail/sendmail.mc using a file editor such as ‘nano’ to add the below code after #dnl define('SMART_HOST', 'smtp.your.provider')dnl.
nano sendmail.mc
/etc/mail/sendmail.mc
define('SMART_HOST', 'smtp.socketlabs.com')dnl
FEATURE('authinfo')dnl
define('RELAY_MAILER_ARGS', 'TCP $h 2525')dnl
Port 587 and 25 can also be used instead of 2525, if necessary.
- To add authorization credentials, edit the file ‘/etc/mail/authinfo’ using your editor and add the following line, replacing ‘SocketLabs_SMTPusername’ and ‘SocketLabs_SMTPpassword’ with your SMTP credentials provided in the Control Panel of your SocketLabs server.
nano authinfo
/etc/mail/authinfo
AuthInfo:smtp.socketlabs.com U:SocketLabs_SMTPusername" "P:SocketLabs_SMTPpassword"
- Update your configuration files
cd /etc/mail
m4 sendmail.mc > sendmail.cf
makemap hash authinfo < authinfo
- Restart the Sendmail service
/etc/init.d/sendmail restart
or
service sendmail restart