ssmtp to send emails

ssmtp is a nice and simple solution for sending emails from the command line etc.

Installing


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

Now edit the SSMTP configuration file


sudo nano /etc/ssmtp/ssmtp.conf

It needs to include this:


root=postmaster
mailhub=smtp.gmail.com:587
hostname=raspberrypi
[email protected]
AuthPass=TheGmailPassword
FromLineOverride=YES
UseSTARTTLS=YES

Save and exit

Sending an email


echo "Hello world email body" | mail -s "Test Subject" [email protected]

Sending A File

Install mpack


sudo apt-get install mpack

To send a file


mpack -s "Test" /home/pi/some_folder/somefile.ext [email protected]

Deja un comentario