Linux serverNETWORK ADMINISTRATIONSsmtp server liux

Mailx configuration/ SMTP POSTFIX in Linux OS

Mailx configuration / SMTP postfix configuration in LINUX OS

Configure Mailx in linux OS
##################################
step1: Install Mailx/postfix packages
yum install postfix mailx cyrus-sasl cyrus-sasl-plain -y

step2. Create GMail Account password
a) Generate App Password – https://support.google.com/mail/answer/185833?hl=en

step3. Edit /etc/postfix/sasl_passwd file and add gmail account details
vi /etc/postfix/sasl_passwd
[smtp.gmail.com]:587 mail_ID:password

step4. Generate DB file
postmap /etc/postfix/sasl_passwd

step5. Edit “/etc/postfix/main.cf” and add below lines to the end of file
relayhost = [smtp.gmail.com]:587
myhostname = dbtech.vm.com

# Enable SASL authentication for postfix
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_tls_security_level = encrypt
smtp_tls_CAfile = /etc/ssl/certs/ca-bundle.crt

# Disallow methods that allow anonymous authentication
smtp_sasl_security_options = no anonymous

# Location of sasl_passwd
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
#######################################################################
step 6: start the postfix using below
systemctl start postfix
systemctl status postfix
systemctl enable postfix

step 7: Send Test MAIL
echo “Test Email” | mail -s “Send Email from Linux” Mail

source

by DBTechNinja

linux smtp server