fetchmail to get the mails from your imap account

Now, that you have set the RPi to send emails, lets do the next best thing. Setup fetchmail so that we can setup a cron job to run and get us the emails on Raspberry Pi. What can we do with these emails, lots 🙂 (I hope you already have a Raspberry Pi, if not then head over to  element14.)

For now, first install fetchmail:

sudo apt-get install fetchmail

and if you are one of the guys who wants easy configuration then :

sudo apt-get install fetchmailconf

If you are using fetchmailconf, then just fire up “fetchmailconf”. You will get a GUI, where you can configure the setting. If not, then you can create a file “~/.fetchmailrc” which should look something like this:

poll 
protocol IMAP
user "" with password "" mda ""
folder 'INBOX'
fetchlimit 1
# do not delete the mails on server.
keep
# do not re-write the headers for the mail, get saner headers for the script to process.
no rewrite
# use ssl
ssl

 

Enhanced by Zemanta

Need Google+ invitaion.. leave a comment here.

 

I just got mine, if you need a google plus invitation leave your email id in comments 🙂

Enhanced by Zemanta

Using ssmtp to send mail using gmail.

First install the package ssmtp using the command:

1
sudo yum install ssmtp

Open the configuration file for ssmtp as root user:

1
vim /etc/ssmtp/ssmtp.conf

Make the following changes to the configuration file:

root=username@gmail.com
mailhub=smtp.gmail.com:587
hostname=username@gmail.com
UseSTARTTLS=YES
AuthUser=username
AuthPass=password
FromLineOverride=yes

In order to make the default (root) “from” field be the server name,
edit the /etc/ssmtp/revaliases file as root user :

1
vi /etc/ssmtp/revaliases

And add into it the desired translation which in our Gmail examples case
will be:

root:[email protected]:smtp.gmail.com

and time to test:

1
echo "Amit Agarwal"|ssmtp <email id>

If this does not work, then you can try with -v or -vv or -vvv for ssmtp command.

Enhanced by Zemanta