Maybe useful for others too, the following code will check for unseen mails and extract the main text.
It uses the atom feed to check for new mails first, so that it doesnt need to bother gmail/imap unnecessarily (google doesnt like checking mails too often)
In the past I used a more complicated setup using fetchmail and procmail. Using Python is extremely more simple.
Interesting and generally useful, thank you. I am just curious why and where do you use this on the Arduino (how you run the script and display the results)?
I will not use the script as such. Eventually I plan to control my project via mail. E.g. I will send a mail to the yun with a request to lower the temperature. I know there exist better mechanisms for controlling over the web, but email is the most simple to start with, and can be used by anyone.