Sunday, November 3, 2013

Getting the arduino Yun ready to receive and read google mails - part5

Now the procmail part. For now I just want all mails sent to me@yafasomething.com to come in a certain file. Again I want all my files on the SD card.

on the SD card create folders (in arduino):

mail.
mail/mailboxes/
mail/mailboxes/yafa/
mail/mailboxes/default

create the file mail/procmailrc containing:

SHELL=/bin/sh
MAILDIR=/mnt/sda1/arduino/mail/mailboxes
DEFAULT=$MAILDIR/default
LOGFILE=$MAILDIR/procmail.log


:0:/mnt/sda1/arduino/mail/procmail.lock
* ^TOme@yafasomething.com
| cat - > yafa/yafa_msg.txt

you can test procmail by e.g.
procmail ./procmailrc < testmail2.txt
where testmail2.txt contains e.g.
From: me@example.com
To: me@yafasomething.com
X-info: I'm just testing

BODY OF MESSAGE SEPARATED BY EMPTY LINE
txt txt txt txt txt txt txt txt txt txt
Now in our fetchmailrc change the procmail line to:

mda "/usr/bin/procmail /mnt/sda1/arduino/mail/procmailrc"

Now if a mail is sent to me@yafasomething.com and we run fetchmail -vk the message should arrive in the specified yafa_msg.txt file. To avoid procmail errors I also created the folder /var/spool/mail, but it is not the goal that something arrives in here.

 This topic is continued here.

No comments:

Post a Comment