sudo apt-get install postfix
After go and edit /etc/postfix/main.cnf :
vi /etc/postfix/main.cnf
Paste the lines.
# Forward mail through Gmail
relayhost = [smtp.gmail.com]:587
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/ssl/certs/Equifax_Secure_CA.pem
Next, create /etc/postfix/sasl_passwd file:
vi /etc/postfix/sasl_passwd
And add this line:
[smtp.gmail.com]:587 [yourusername]@gmail.com:[yourpassword]
Note: Change [yourusername] and [yourpassword] with your Gmail access details.
Now modify file permissions and generate sasl_passwd.db by running these commands one by one:
cd /etc/postfix
postmap sasl_passwd
chmod 600 sasl_passwd sasl_passwd.db
Now restart the postfix to have affected.
sudo service postfix restart
After, send a test email:
sudo apt-get install mailutils
And:
echo 'Success!' | mailx -s 'Test Message' [youremail_address]
Note: Change [youremail_address] with your email.
Now you have successfully installed Postfix.
Enjoy
Register for free account now.