Reading Email Using C#

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • x3zinja12
    New Member
    • Oct 2011
    • 1

    Reading Email Using C#

    I need to be able to read emails with the POP3 of C#. I have gotten the code so far:


    // connect to pop3 server
    POP3Client pop = new POP3Client ();
    pop.ReceiveTime out = 3 * 60000; // Set the timeout to 3 minutes
    pop.Open ("mymailserver" , "110", "sampleuser ", "password") ;

    // retrieve messages list from pop server
    POPMessageId[] messages = pop.GetMailList ();

    if (messages != null)
    {
    // run through available messages in POP3 server
    foreach (POPMessageId id in messages)
    {
    POPReader reader = pop.GetMailRead er (id.Id);
    MimeMessage msg = new MimeMessage ();

    // read the message
    msg.Read (reader);
    //delete message
    pop.Dele (id.Id);
    }
    }
    //close the connection to POP3 server
    pop.Quit ();

    but I am having trouble with the POPReader with the "id.Id". Help would be appreciated.
Working...