Skip to Content

Configure SMTP on Ezeelogin Jump server

How to configure SMTP relay with Sendmail?

Install Sendmail

Ubuntu / Debian systems

apt install sendmail 

 Centos/RHEL

yum install sendmail

1. Create Authentication file.
 
Create a directory in /etc/mail directory 
 

sudo mkdir /etc/mail/authinfo

sudo chmod 700 /etc/mail/authinfo

 
2. Create an authentication file and add the following. Replace the following email with your mail credentials.
 

 sudo vi /etc/mail/authinfo/smtp-auth

AuthInfo: "U:root" "I:[email protected]" "P:PASSWORD"

 Create a hash map file of the above authentication file as follows

makemap hash /etc/mail/authinfo/smtp-auth < /etc/mail/authinfo/smtp-auth

3. Configure Sendmail 
 
Add the following parameters into your sendmail.mc configuration file below the "MAILER_DEFINITIONS" definition.
 define(`SMART_HOST',`[smtp.gmail.com]')dnl
 define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl
 define(`ESMTP_MAILER_ARGS', `TCP $h 587')dnl
 define(`confAUTH_OPTIONS', `A p')dnl
 TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
 define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
 FEATURE(`authinfo',`hash -o /etc/mail/authinfo/smtp-auth.db')dnl
 Save and re-build sendmail configuration 
 

make -C /etc/mail

 
4. Restart the mail server
 

Service restart sendmail

 

Now send a test email 

 

echo 'e-Mail TEST SMTP RELAY'| mail -s TESTMAIL [email protected]