Step-by-step guide on how to use your Gmail account as your email sender via SMTP

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 postfix

Yum install mail x

yum install
Postfix Configuration

/etc/postfix/main.cf

  • cd etc/posfix
  • ls -ltr
ls -ltr
Add the Following lines
  • relay host = [smtp.gmail.com]:587
  • my hostname= <your_ hostname>
  • vi main.cf
advances linux
advances linus
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

Disallow method

Create a file under /etc/postfix/sasl/
Filename: sasl_passwd
Add the below line
[smtp.gmail.com]:587 email@gmail.com:password

postfix
  • vi sasl _passwd
smtp. gmail

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

chmod

Start the Postfix service

systemctl start/enable postfix
systemctl stop/disable postfix
systemctl restart postfix

systemctl status
How to Send email

echo “Test Mail | ma -s “postfix Test”
paul@gmail.com

gmail

Leave a Comment

%d bloggers like this: