Email from Gmail

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 smtp-auth-user=youremail@gmail.com
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” themailaddress@yourprovider.com

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s