Netduino home hardware projects downloads community

Jump to content


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.
Photo

Is that a Netduino Plus reading my mail?


  • Please log in to reply
10 replies to this topic

#1 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 26 January 2012 - 12:19 AM

Hi!

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();

Download source code at http://netmftoolbox....ol/BrowseLatest :)
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#2 Valkyrie-MT

Valkyrie-MT

    Advanced Member

  • Members
  • PipPipPip
  • 315 posts
  • LocationIndiana, USA

Posted 26 January 2012 - 03:33 AM

It read my emails today!


That is awesome!

-Valkyrie-MT

#3 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 26 January 2012 - 04:36 AM

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.

#4 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 26 January 2012 - 04:40 AM

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

#5 Bendage

Bendage

    Advanced Member

  • Members
  • PipPipPip
  • 153 posts
  • LocationIrvine, CA

Posted 26 January 2012 - 05:40 AM

Nice! But does it speak them? Then I'd bow down! ;)

#6 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 26 January 2012 - 06:29 AM

Nice!

But does it speak them?

Then I'd bow down! ;)


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.

#7 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 26 January 2012 - 08:14 AM

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.
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#8 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 26 January 2012 - 08:14 AM

But does it speak them?

You mean a bit like this? http://forums.netdui...ino-says-hello/
:D

Nah, would be scary! Then my neighbours might hear all the secrets that are in my mail :o
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#9 smarcus3

smarcus3

    Advanced Member

  • Members
  • PipPipPip
  • 134 posts

Posted 08 April 2012 - 11:26 PM

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.
Steve


My Other Hobby: Engineer Turned Baker

#10 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 09 April 2012 - 08:42 AM

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();

Hi smarcus3,

That's because GMail doesn't support non-encrypted POP3-connections. The TCP port 995 is for POP3S.
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#11 MegaOhm

MegaOhm

    New Member

  • Members
  • Pip
  • 8 posts

Posted 06 November 2012 - 02:07 PM

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.


How would you go about clearing the mailbox after the messages are read.?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.