sSMTP - Simple SMTP
sSMTP is a simple MTA to deliver mail from a computer to a mail hub (SMTP server). sSMTP is simple and lightweight, there are no daemons or anything hogging up CPU; Just sSMTP. Unlike Exim4, sSMTP does not receive mail, expand aliases, or manage a queue.
Setting up sSMTP
sSMTP's main configuration file is located at /etc/ssmtp/ssmtp.conf
Here is a sample configuration file taken from my /etc/ssmtp/ssmtp.conf:
# # Config file for sSMTP sendmail # # The person who gets all mail for userids < 1000 # Make this empty to disable rewriting. root=yourmail@mail.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=smtp.yourmail.com # Where will the mail seem to come from? rewriteDomain= # The full hostname hostname=yourserver.example.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 # Username and password for Google's Gmail servers # From addresses are settled by Mutt's rc file, so # with this setup one can still achieve multi-user SMTP AuthUser=username@gmail.com AuthPass=password #### VERY IMPORTANT !!! If other people have access to this computer # Your GMAIL Password is left unencrypted in this file # so make sure you have a strong root password, and make sure # you change the permissions of this file to be 640: # chown root:mail /etc/ssmtp/ssmtp.conf # chmod 640 /etc/ssmtp/ssmtp.conf # # add your user to the group mail # usermod -a -G mail <yourUserName> # quit all your sessions # login again # send a test mail: # user@yourmachine ~ $ ssmtp "testing ssmtp setup" yourMail@gmail.com
Using sSMTP with Gmail
Using sSMTP with Gmail is simple, you just have to change a few options around and add in TLS encryption and change Google's server to port 587
AuthMethod=LOGIN UseTLS=YES UseSTARTTLS=YES mailhub=smtp.gmail.com:587
And that's all. Now just tell your MUA to run /usr/sbin/ssmtp for outgoing mails, and you should be set. This also works with Google for Domains.