Configure SMTP on Ezeelogin Jump server
How to configure SMTP relay with Sendmail?
Overview: This article describes the steps to configure an SMTP relay using Sendmail on Linux-based systems, enabling secure email transmission via an external SMTP server.
Install Sendmail
In Ubuntu / Debian systems
root@gateway:~# apt install sendmail
root@gateway:~# yum install sendmail
root@gateway:~# sudo mkdir /etc/mail/authinfo
root@gateway:~# sudo chmod 700 /etc/mail/authinfo
root@gateway:~# 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
root@gateway:~# makemap hash /etc/mail/authinfo/smtp-auth < /etc/mail/authinfo/smtp-auth
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
root@gateway:~# make -C /etc/mail
root@gateway:~# service restart sendmail
root@gateway:~# echo 'e-Mail TEST SMTP RELAY'| mail -s TESTMAIL [email protected]