The Quick-N-Dirty Guide to ssmtp

The aim of this QND guide is to get you up and running quickly with ssmtp. There will be far more how than why here.

The ssmtp program is designed to be a substitute for sendmail (or postfix, exim and other heavy duty MTA’s) for people who need an external smtp program to send mail, such as those who use mutt. While it is slightly more complex and heavy than nbsmtp (no brainer smtp) it is a bit more efficient, writes to /var/log/maillog and has a few nice features.

1.) Do you have ssmtp?

I don’t know of any Linux distro or other *nix system that installs ssmtp by default. However, it never hurts to check. At a command line type

which ssmtp

If you get a response like /usr/bin/ssmtp or /usr/local/sbin/ssmtp, you can skip to step 3. Otherwise, continue with step 2.


First follow the instructions in the QND software guide for information on getting and installing ssmtp. If it’s not included with your distribution (while it is in Gentoo’s portage and FreeBSD’s ports, it doesn’t seem to be on any of the RedHat 8.0 CD’s) then go to the homepage. They have a tar.gz file.

3.)Installing ssmtp

FreeBSD’s ports or Gentoo’s portage will install ssmtp for you. If you’ve downloaded the tarball then untar it somewhere and install it in the more or less usual way. This will have to be done as root or with root privilege.

tar -zxvf ssmtp*tar.gz
cd ssmtp*
make install

4.)Configuring ssmtp

The ssmtp program will install either a sample conf file or the actual file in /usr/etc or perhaps /usr/local/etc, depending upon distribution. This file will have to be edited slightly to make it work. Some of the comments in the file can be a bit misleading. I am including an entire file from a FreeBSD installation, with the hope that it will be clearer where you have to make changes. I am typing in ALLCAPS above the lines that you will have to change.

# /etc/ssmtp.conf -- a config file for sSMTP sendmail.

# The person who gets all mail for userids < 1000

# 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.



# Example for SMTP port number 2525
# mailhub=mail.your.domain:2525
# Example for SMTP port number 25 (Standard/RFC)
# mailhub=mail.your.domain        
# Example for SSL encrypted connection
# mailhub=mail.your.domain:465

# Where will the mail seem to come from?



# The full hostname



# 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.

# Use SSL/TLS certificate to authenticate against smtp host.

# Use this RSA certificate.

For our example, we’ll assume that your isp is called and their smtp server is The local hostname is The first line to be changed is the one marked mailhub=mail In our case, with an smtp server called it should be changed to read

Next, we cover the line that reads rewriteDomain=
Using our example of having an isp called it should be changed to read

In other words, the domain of your isp, eg or whatever. Next, the hostname. The line that reads hostname should be changed to the local hostname.

The last change to be made is in the line that says FromLineOverride=YES. Many people, (judging from google) including myself, found that line a bit confusing. If you don’t uncomment it (by removing the # sign) you may find that all your mail comes from User &. So, uncomment it.

5.) Testing ssmtp

To test ssmtp, try sending an email. You can send one to yourself, and make sure you get it, or elsewhere. You can also look at /var/log/maillog which should show that the mail was sent successfully.


man ssmtp