How to send email from Ubuntu Server using ssmtp
What do you do when installing PostFix and turning your VPS or atom based home server into a full blown mail server is an overkill? What if you really really need it to send mail?
I have the VPS that hosts several wordpress blogs. Without mail server configured wp couldn’t send “lost password” or “new comment” emails. To fix this I decided to install ssmtp package (which simply authenticates to 3rd party smtp server, gmail in this case, to deliver mail).
Instructions for ubuntu server
1 2 |
sudo apt-get update sudo apt-get install ssmtp |
Configuring ssmtp
1 |
sudo vi /etc/ssmtp/ssmtp.conf |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# Config file for sSMTP sendmail # # The person who gets all mail for userids < 1000 # Make this empty to disable rewriting. #root=postmaster root=MyEmailAddress@gmail.com # The place where the mail goes. The actual machine name is required no # MX records are consulted. Commonly mailhosts are named mail.domain.com #mailhub=mail mailhub=smtp.gmail.com:587 AuthUser=MyEmailAddress@gmail.com AuthPass=MyPassword UseTLS=YES UseSTARTTLS=YES # Where will the mail seem to come from? #rewriteDomain= rewriteDomain=gmail.com # The full hostname #hostname=MyMediaServer.home hostname=MyEmailAddress@gmail.com # Are users allowed to set their own From: address? # YES - Allow the user to specify their own From: address # NO - Use the system generated From: address FromLineOverride=YES |
That’s about it. In comparison you would have to spend a day configuring PostFix.
Leave a Reply