Googlemail and sSMTP on CentOS

      3 Comments on Googlemail and sSMTP on CentOS

sSMTP is a very simple and straightforward alternative to big MTAs like sendmail or Exim. Unfortunately CentOS repositories don’t come with it, so you have to fetch it from Fedora’s EPEL repo.

rpm -Uvh

After activating the ‘Extra Packages for Enterprise Linux’ repository, you can install sSMTP:

yum install ssmtp

Configuration is rather simple. Just change the following values in your /etc/ssmtp/ssmtp.conf

# The person who gets all mail for userids < 500
# Make this empty to disable rewriting.

# The place where the mail goes. The actual machine name is required
# no MX records are consulted. Commonly mailhosts are named
# The example will fit if you are in and your mailhub is so named.


# Set this to never rewrite the "From:" line (unless not given) and to
# use that address in the "from line" of the envelope.

# Use SSL/TLS to send secure messages to server.



You can test by sending a mail to user@domain.tld

# echo test | mail -s "testing ssmtp" user@domain.tld

Resources and further reading:

3 thoughts on “Googlemail and sSMTP on CentOS

  1. Pingback: /dev/blog » ssmtp revaliases, aliases and mail.rc

  2. Pingback: Using ssmtp securely on CentOS « mbrownnyc

  3. avatardt

    I am able to send mail using ssmtp by using the cmdline, but only, if I specify the -au and -ap flags with corresponding values.
    The exact same values, as I’ve already specified in the /etc/ssmtp/ssmtp.conf .

    – 1.) This would work:
    ssmtp -au -ap “abc 123ZZZ98” -v -t < /root/bin/msg01.txt

    – 2.) This would NOT work :
    ssmtp -v -t < /root/bin/msg01.txt
    – It dies with authentication error:
    [<-] 334 UGFzc3dvcmQ6
    [<-] 535 5.7.8 Error: authentication failed: authentication failure
    ssmtp: Authorization failed (535 5.7.8 Error: authentication failed: authentication failure)

    In my ssmtp.conf I got:
    AuthPass="abc 123ZZZ98" (<<== notice the embedded space in the password)

    As ssmtp needs to be called from php on the website (contact form), the no. 2.) version would be needed.

    I got sSMTP v2.64 on Ubuntu 15.04 64 Bit ( Linux xyz 3.19.0-33-generic #38-Ubuntu SMP… )

    I just wonder what I'm missing here … since hours. Can't get it working. Would be very glad for some help.
    Thanks a lot.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.