How to Send Emails Using G mail Smtp services.
- Postfix Setup on Linux Centos
- Edit Configuration for Google SMTP
- How to send email
- how to attach a file in email
Installation
- yum install post fix
- yum install mail x
Yum install mail x
Postfix Configuration
/etc/postfix/main.cf
- cd etc/posfix
- ls -ltr
Add the Following lines
- relay host = [smtp.gmail.com]:587
- my hostname= <your_ hostname>
- vi main.cf
Add the Following lines
Location of sasl_passwd we saved
smtp_sasl_password_maps = hash:/etc/postfix/sasl/sasl_passwd
Enables SASL authentication for postfix
smtp_sasl_auth_enable = yes
smtp_tls_security_level = encrypt
Disallow methods that allow anonymous authentication
smtp_sasl_security_options = noanonymous
Create a file under /etc/postfix/sasl/
Filename: sasl_passwd
Add the below line
[smtp.gmail.com]:587 email@gmail.com:password
- vi sasl _passwd
Convert the sasl_passed file into db file
postmap /etc/postfix/sasl_passwd
For the security, change the file ownership
chown root:root /etc/postfix/sasi_passwd
chmod 600 /etc/postfix/sasi/sasi_passwd
Start the Postfix service
systemctl start/enable postfix
systemctl stop/disable postfix
systemctl restart postfix
How to Send email
echo “Test Mail | ma -s “postfix Test”
paul@gmail.com