Setting up mail on an RPi to an SMTP host

Here a short description how I set up my RPi to send mail, usually sent to the users mbox to an SMTP server.

Installation requirements

Additional to the default Raspbian image I've installed these additional packages:

sudo apt-get update
sudo apt-get install ssmtp mailutils

SMTP Server settings

I've configured my RPi to talk to my ALFAHOSTING mailboxes:

Create a mailbox on ALFAHOSTING
Set name of the mail account to <<Diese E-Mail-Adresse ist vor Spambots geschützt! Zur Anzeige muss JavaScript eingeschaltet sein!>>

RPi settings

/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=dev-rasp
# 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=<<mydomain.com>>
AuthUser=<<alfohosting mail user>>
AuthPass=<<mail password for above>>>

# security enabled
UseSTARTTLS=YES
UseTLS=YES
# Where will the mail seem to come from?
#rewriteDomain=
# The full hostname
hostname=<<mydomain.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=NO

 

/etc/ssmtp/revaliases

# sSMTP aliases
#
# Format: local_account:outgoing_address:mailhub
#
<<raspi username>>:<<Diese E-Mail-Adresse ist vor Spambots geschützt! Zur Anzeige muss JavaScript eingeschaltet sein!Diese E-Mail-Adresse ist vor Spambots geschützt! Zur Anzeige muss JavaScript eingeschaltet sein!>