Thursday 11 April 2013

Email from Raspberry Pi.

OK - Next thing I want to be able to do is to send mail from the RPi.

Following some of the instruction from http://iqjar.com/jar/sending-emails-from-the-raspberry-pi/

1 - Create a suitable gmail account to send mail from.
2. - sudo apt-get update
3. - sudo apt-get install ssmtp
4. - Edit /etc/ssmtp/ssmtp.conf


pi@raspberrypi /etc/ssmtp $ grep -v "^#" ssmtp.conf |grep -v "^$"
root=postmaster
mailhub=smtp.gmail.com:587
hostname=raspberrypi
AuthUser=myuser@gmail.com
AuthPass=mypassword
UseSTARTTLS=YES

5. - Edit /etc/ssmtp/revaliases

root:root@my.domain:smtp.gmail.com:587
pi:pi@my.domain:smtp.gmail.com:587

6. - Test it..... create a file called message.txt which will contain the message. - e.g.

pi@raspberrypi ~/mail $ cat message.txt
From: my.address@gmail.com
Subject: test email

hello world!
It works!


Now run command - ssmtp destination.address@gmail.com < message.txt

Cool - it works!

No comments:

Post a Comment

Note: only a member of this blog may post a comment.