Summary:
--------
We can use Gmail account as a free SMTP server on your Ubuntu system. The configuration as following steps
Step 1:
-------
Install postfix and associated packages
$ sudo apt-get install postfix mailutils libsasl2-2 ca-certificates libsasl2-modules
Step 2:
-------
Open your postfix config file:
vim /etc/postfix/main.cf
add the following command
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_CAfile = /etc/postfix/cacert.pem
smtp_use_tls = yes
Step 3:
-------
Configure gmail username and password
open sasl_passwd file or create
$ vim /etc/postfix/sasl_passwd
Add the username and password
[smtp.gmail.com]:587 USERNAME@gmail.com:PASSWORD
Step 4:
-------
Apply permission for the created file
sudo chmod 400 /etc/postfix/sasl_passwd
sudo postmap /etc/postfix/sasl_passwd
Step 5:
-------
Create certificate file for authenticate
$ cat /etc/ssl/certs/Server_CA.pem | sudo tee -a /etc/postfix/cacert.pem
Step 6:
-------
Reload the postfix server
$ sudo /etc/init.d/postfix reload
Step 7:
-------
Check mail weather its sending or not
$ echo "Test mail from postfix" | mail -s "Test Postfix" you@example.com
No comments:
Post a Comment