Config ssmtp
Home Up


Configuring ssmtp

ssmtp needs a bit of configuration to ensure it sends the mail somewhere sensible. Its configuration file is located in /etc/ssmtp/ and is called ssmtp.conf and looks like this:


# /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 you mailhub is so named.
# Where will the mail seem to come from?
# The full hostname


The hostname is supposed to be the full name of the machine sending the mail. For plusnet it's <your account name> 

The hostname is supposed to match your reverse DNS name, though it's usually not essential. 


"rewritedomain" is the domain name that is added to a local username to turn it into a full email address e.g. "<username>@<rewritedomain>" . If it is commented out ssmtp will set this to the hostname instead.


The root alias is the email address that the mail is sent to by default (though not necessarily the address that will appear in the To field).

ssmtp can be called with a full email address, in which case it will always send the email to that address with no modification.

ssmtp can also be called with just a local username as the destination. If you only supply ssmtp with a username then ssmtp will look for the root alias to find the actual email address to send to. If the root alias only contains a username then ssmtp will add the rewritedomain to make a full email address. 

I've checked and the SlugOS "ssmtp" does use the supplied username as destination for a userid above 999, for example the "nobody" user. Also you can comment out the root line in which case ssmtp will construct the "to" address from the current username (for cron it's always "root").


The mail hub is the machine that you use to send the mail, this would normally be your ISP's "SMTP server". For plusnet that is

It's possible to pass mail to a local machine if you are running a LAN with a mailserver, however if you are running a mailserver you'll probably know far more about email than I do.


The revaliases file defines what will appear in the "from" field of the email.

It's a good idea to set up an alias to force the "From:" line to a sensible value so edit the revaliases file:

# sSMTP aliases
# Format: local_account:outgoing_address:mailhub
# Example: root:your_login@your.domain:mailhub.your.domain[:port]
# where [:port] is an optional port number that defaults to 25.

You can add lines for each username that you intend to use. Note that since cron runs as root all reports from cron are addressed from user "root". Set the root's email address to a valid address as if a message bounces this is where it will end up.

You need to specify the mailhub again here.

ssmtp.conf continued...

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


I don't know what this one does, it doesn't appear in the SlugOS ssmtp.conf but it turns up in other versions on the net.

Home Up