If you are like me and you are running your Raspberry Pi headless, and don't want to start up X windows to send a simple email. You are in luck, as this can easily be done from the command line. And it is very easy to setup.
Note; This is only to send email, and not receive.
- Install SSMTP
pi@raspberrypi ~ $sudo apt-get install ssmtp
-Configure SMTP
Add add these lines;
mailhub=smtp.gmail.com:465
rewriteDomain=gmail.com
AuthUser=username
AuthPass=password
FromLineOverride=YES
UseTLS=YES
Use your email address for root, and your gmail username and password for AuthUser and AuthPass.
To send an email
To send an email, run SSMTP with the recipients name.
SSMTP will then wait for you to type your email. It has to be formatted as shown below. And once done, press Ctrl-D to send.
subject: this is a test
hello world!
pi@raspberrypi ~ $
Continue reading Send emails with attachements from the Linux command line.