0% found this document useful (0 votes)
6 views1 page

Mail Using Postfix

This document provides instructions for configuring Postfix to send emails using Gmail's SMTP server. It includes steps for editing the main configuration file, setting up SASL authentication, and creating a password file for secure email sending. Additionally, it describes how to send emails and attachments using the mail command in the terminal.

Uploaded by

iwantsatyam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views1 page

Mail Using Postfix

This document provides instructions for configuring Postfix to send emails using Gmail's SMTP server. It includes steps for editing the main configuration file, setting up SASL authentication, and creating a password file for secure email sending. Additionally, it describes how to send emails and attachments using the mail command in the terminal.

Uploaded by

iwantsatyam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

apt install postfix

apt install mailutils


cd /etc/postfix
vi /main.cf
comment
#smtp_tls_security_level=may

Add
relayhost = [smtp.gmail.com]:587
myhostname = prashant-server
and comment to old one
#myhostname = prashant-server.TL-WA850RE

And at the end of line

smtp_sasl_auth_enable = yes
smtp_tls_security_level = encrypt
smtp_sasl_password_maps = hash:/etc/postfix/sasl/sasl_passwd
smtp_sasl_security_options = noanonymous

save the file


++++

cd sasl
touch sasl_passwd
vi sasl_passwd
add following
[smtp.gmail.com]:587 [email protected]:apppassword
then save and exit

then make the db file with following command


postmap sasl_passwd
after that you may remove the sasl_passwd as new sasl_passwd.db file has been
created and will be used for sending email

To send the email run following command

echo "This is Mail Content" | mail -s "Subject of Mail"


[email protected]
To send email with attachment use following command

echo "This is Mail Content" | mail -s "Subject of Mail" -A file1


[email protected]

You might also like