Setting up sSMTP on your Pi

sSMTP is an easy way to get emails (think of alerts) from your Pi

The following website has good info:

ssmtp to send emails


The commands are:

sudo apt-get install ssmtp
sudo apt-get install mailutils
sudo apt-get install mpack  # to attach files


# edit the config file

sudo nano /etc/ssmtp/ssmtp.conf

** change the permissions to make the file NOT readable by everyone (e.g. remove read permissions from “other” users)

** When using a service other than gmail, you may need to update revaliases (/etc/ssmtp/revaliases) to change the “from” address

** You also may need to change the setting in Gmail to allow unsecure apps


Now, let’s test!

echo “sample text” | mail -s “Subject” username@domain.tld

##  And to send attachments:  ##
mpack -s “test” /home/pi/test/somefile.ext username@domain.tld

Leave a Reply

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