Tuesday, November 5, 2024

smtp configure

 

                                                                     SMTP SETUP IN LINUX

 

Smtp configuration with gmail.

 

 

Step1)

  create one gmail user

 

step2)

install packages

Yum install postfix

 

step 3)

check telnet

telnet smtp.gmail.com 587

telnet smtp.gmail.com 465

 

 

 

step4)

Configure the Postfix Relay Server (Gmail)

Configure the Postfix Relay Server (Gmail)

Postifx configuration file vi /etc/postfix/main.cf

relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = encrypt
inet_protocols = ipv4

Configure the Postfix Relay Server (Office365)

relayhost = [smtp. office365.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = encrypt
inet_protocols = ipv4

 

 

 

step4)

 

[root@ postfix]# vi /etc/postfix/sasl_passwd                                  (add below entries in sasl_passwd)


[smtp.gmail.com]:587               username:password

Example :   [smtp.gmail.com]:587              manueldba4@gmail.com: Manueldba123

 

Create hash db file for Postfix

postmap /etc/postfix/sasl_passwd

 

restart postfix:

postfix reload or systemctl restart postfix

 

step 5)

 

echo "mail is working"| mail -r manueldba4@gmail.com -s "linux it’s ok" manueldba4@gmail.com

 

mailq ( check mailq)

 

 

No comments:

Post a Comment