top of page

CONFIGURE && SEND-MAIL ON POSTFIX WITH GMAIL ON CENTOS 7 LINUX ADMINISTRATION

  • Fredrick Were
  • Aug 15, 2018
  • 1 min read

############################################################################ # Program : CONFIGURE && SEND-MAIL ON POSTFIX with GMAIL ON CENTOS 7 # : Script: email_config_centos7{{ mail -s }} # : script: mail_config_cent7.sh # Author : FWERE # Team : Documentum # Date : Aug 14,2018 ############################################################################ #!/bin/bash

postfix() { printf "%s\n" "Updating needed mail packages" printf "%s\n" "****************************************************"

#yum -y clean-all update install postfix cyrus-sasl-plain mailx

yum clean-all && yum -y remove mail* && yum -y install postfix cyrus-sasl-plain mailx && Yum -y update

printf "%s\n" "Updating postfix" systemctl restart postfix && systemctl enable postfix

printf "%s\n" "Updating postfix config file "

#vi /etc/postfix/main.cf echo " #---------------------------------------------- # ADD relayhost = [smtp.gmail.com]:587 smtp_use_tls = yes smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_tls_CAfile = /etc/ssl/certs/ca-bundle.crt smtp_sasl_security_options = noanonymous smtp_sasl_tls_security_options = noanonymous #------------------------------------------------------- " >> /etc/postfix/main.cf

printf "%s\n" "Setting Postfix SASL Credentials" #vi /etc/postfix/sasl_passwd # update the user and passwd echo " #------------------------------------------- [smtp.gmail.com]:587 fwere:password1234 #------------------------------------------ " >> /etc/postfix/sasl_passwd

printf "%s\n" "Generate A Postfix lookup table"

postmap /etc/postfix/sasl_passwd

printf "%s\n" "Update file permissions"

chown root:postfix /etc/postfix/sasl_passwd* && chmod 640 /etc/postfix/sasl_passwd*

printf "%s\n" "Reload the POSTFIX service"

systemctl reload postfix && sleep 2;

printf "%s\n" "Testing time **************************************" # update your email adrress echo "This is a test." | mail -s "test message" MEE@gmail.com

printf "%s\n" "VERIFY the test result" tail -f /var/log/maillog # myweblogic postfix/smtpd[26947]: connect from localhost[127.0.0.1] printf "%s\n" "Good &Done!" printf "%s\n" "Enjoy" exit 0

} ########################################################################### # main script #################### postfix

 
 
 

Comments


©2018 by OPEN LINUX LEARNING. Proudly created with Wix.com

bottom of page