The Netduino forums have been replaced by new forums at community.wildernesslabs.co.
This site has been preserved for archival purposes only
and the ability to make new accounts or posts has been turned off.
This evening I spend playing with my Netduino Plus. It read my emails today!
Now why would this be useful? A proper next step could be a seperate LCD, displaying my last email messages. Or just a blinking led when I have new mail. Who knows, it's all possible.
With just a small bit of code, I can see how much mails I have. And with a few more lines, I'll even get some more details:
POP3_Client Mailbox = new POP3_Client(new SimpleNETMFSocket("pop.yourisp.com", 110), "yourusername", "yourpassword");
Mailbox.Connect();
Debug.Print("Message count: " + Mailbox.MessageCount.ToString());
Debug.Print("Box size in bytes: " + Mailbox.BoxSize.ToString());
uint[] Id, Size;
Mailbox.ListMails(out Id, out Size);
for (int Index = 0; Index < Id.Length; ++Index)
{
string[] Headers = Mailbox.FetchHeaders(Id[Index], new string[] { "subject", "from", "date" });
Debug.Print("Mail ID " + Id[Index].ToString() + " is " + Size[Index].ToString() + " bytes");
Debug.Print("Subject: " + Headers[0]);
Debug.Print("From: " + Headers[1]);
Debug.Print("Date: " + Headers[2]);
Debug.Print("======================================================================");
}
Mailbox.Close();
Stefan, my congrats! Let me finish the LCD lib, so you can complete this nice tool...
Just a question: it could be possible to implement the IMAP protocol, instead of the POP3? I'd rather like that, much more reliable.
Thanks
Cheers
Biggest fault of Netduino? It runs by electricity.
Uh oh, your Netduino Plus is now spying on the e-mails I send you.
It all starts out by innocently "processing e-mails." Next step..."open the pod bay door""
Cool project!
Chris
UGH!...Do you really like a speaker reading for you all the junk-ads incoming in the mailbox?
Okay, Stefan...if you'll be able to make the Netduino talking, then provide also a *BIG* button to shut it up!
Biggest fault of Netduino? It runs by electricity.
Just a question: it could be possible to implement the IMAP protocol, instead of the POP3? I'd rather like that, much more reliable.
Hi Mario,
IMAP could be possible, but the IMAP protocol has way more overhead. I chose for POP3 since it's very light, thus better for the Netduino Plus in RAM. Both protocols are reliable by the way, they just act different;
- POP3 is ment as a mailbox at the post office where you collect your mail, and take it home. It's common to empty your mailbox at the end of your session (although I didn't include that in my code, since I bet you don't want your netduino erasing your mail), but the post office wouldn't like you rearranging your mailbox and put outgoing mail in it.
- IMAP is ment as a storage facility. Your mail gets delivered there, you can come to the storage facility to read and reply your mail, there's even a box for outgoing mail, and you can leave whenever you like. When you come back, you'll find your mail in the same state, plus additional new mail.
It's a different approach in mail, not more or less reliable, just more or less complicated.
I cannot get this code to work.
I am using: pop.gmail.com, 995
username **********@gmail.com
and using breakpoints it never gets to the line after mailbox.connect();
Please help.
IMAP could be possible, but the IMAP protocol has way more overhead. I chose for POP3 since it's very light, thus better for the Netduino Plus in RAM. Both protocols are reliable by the way, they just act different;
- POP3 is ment as a mailbox at the post office where you collect your mail, and take it home. It's common to empty your mailbox at the end of your session (although I didn't include that in my code, since I bet you don't want your netduino erasing your mail), but the post office wouldn't like you rearranging your mailbox and put outgoing mail in it.
- IMAP is ment as a storage facility. Your mail gets delivered there, you can come to the storage facility to read and reply your mail, there's even a box for outgoing mail, and you can leave whenever you like. When you come back, you'll find your mail in the same state, plus additional new mail.
It's a different approach in mail, not more or less reliable, just more or less complicated.
How would you go about clearing the mailbox after the messages are read.?