Install Postfix and command line mail utility using the following command:
sudo apt-get install postfix mailutils
Backup the default configuration file for postfix:
sudo cp /etc/postfix/main.cf /etc/postfix/main.cf.bk
Edit the /etc/postfix/main.cf file:
sudo nano /etc/postfix/main.cf
Delete everything from main.cf file and add this:
smtp_sasl_security_options = noanonymous
relayhost = [smtp.gmail.com]:587
smtp_use_tls = yes
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/googleapps/password
Create a directory googleapps under /etc/postfix:
sudo mkdir /etc/postfix/googleapps
Move to the /etc/postfix/googleapps directory:
cd /etc/postfix/googleapps/
Create a file named password inside /etc/postfix/googleapps directory:
sudo nano password
Add the following contents to the password file:
[smtp.gmail.com]:587 arbab.nazar@rbgeek.com:password
Note: arbab.nazar@rbgeek.com is a Google apps mail address of mine with false password, you can use your original Google apps email address and password here.
Change the permission on password file:
sudo chmod 600 password
Transform the password file into a hashed table:
sudo postmap password
Copy CA root certificates to postfix directory:
sudo cp /etc/ssl/certs/ca-certificates.crt /etc/postfix/cacert.pem
Restart the postfix service:
sudo /etc/init.d/postfix restart
Test the postfix server by sending an email to another account:
echo "Testing" | mail -s "Email from tendo" arbabnazar@ymail.com
Check the destination email account:
Hope this will help you!
No comments:
Post a Comment