Finnian's blog

Software Engineer based in New Zealand

1-Minute Read

I think it is extremely useful to let your little tub of yumminess into your email (Gmail) account. I thought you might find it interesting and useful aswell!

Here is what I did.

Before you do anything else I suggest setting up a test Gmail account for the Pi to use, as if it goes wrong, Pi knows what’ll happen!

First run (as root, or with sudo), this installs mailx (the client) and elinks:

apt-get install heirloom-mailx elinks

Then copy this code into a ~/.mailrc file - (nano ~/.mailrc), modifying to your needs:

account gmail { set smtp-use-starttls set smtp=smtp://smtp.gmail.com:587 set smtp-auth=login set [email protected] set smtp-auth-password=yourpassword set from=“Whatever” }

All done! You can now send an email in the command line, or by using a (link) shell script!!:

echo “Your text Body” | mailx -A gmail -s “Subject” [email protected]

Recent Posts