Search This Blog

Sunday, February 20, 2011

Linux, Get Your Linux to Send Email with your Google account in 1 minute


For many users who already have Gmail accounts (or other email accounts), why not just use Gmail to deliver email for you if you simply want to send email from your machine? ssmtp is a very nice MTA to do this, securely.

sudo apt-get install ssmtp heirloom-mailx

edit your /etc/ssmtp/ssmtp.conf

root=youremail@gmail.com
mailhub=smtp.gmail.com:587
UseSTARTTLS=yes
UseTLS=yes
AuthUser=youremail@gmail.com
AuthPass=yourgmailpassword

Now run a simple test, send a email from your machine
echo "SSMTP" | mailx -s 'Hi' youremail@gmail.com

You are done!
Also, get the right permission to secure your password.
http://wiki.freebsd.org/SecureSSMTP
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=500454

Now you can even use your editor such as emacs to send email.
  • C-x m (compose a email)
  • fill the email header and body
  • C-c C-s (send email)
done!

why not Sendmail or Postfix?
They are overkill. and good luck maintaining your own SMTP server :)
If you want your lovely Linux box to send email, you need to configure it as a mail server. That means you want to install/configure a SMTP server on your machine. Sendmail and Postfix are the powerful Mail Transfer Agent (MTA) to install for this purpose. The are ridiculously powerful to send and receive mail, with the cost that you might spend hours on configuration.

No comments: