tags:

views:

413

answers:

6

Hi,

Does .NET have a way to pull email from a POP3 server out of the box or you have to code/buy a 3rd party component?

A: 

Check out the EasyMail objects from Quiksoft. They are very easy to use and the support is really good.

Robert Wilkinson
+1  A: 

3rd party components are the way the go; much better than the alternative, which would be sending raw POP3 commands with NetStreams [shudder]

Bullines
A: 

Hi! CodeProject got a good C# tutorial on this http://www.codeproject.com/KB/IP/despop3client.aspx Also check out:

http://www.developerfusion.com/article/4071/how-to-pop3-in-c/

Israr Khan
A: 

I personally like the serverintellect components.

Mischa Kroon
serverintellect is a hosting company!
A: 

You can check Mail.dll .NET mail component, it has SSL support, unicode, and multi-national email support:

using(Pop3 pop3 = new Pop3())
{
    pop3.Connect("mail.host.com");      // Connect to server
    pop3.Login("user", "password");

    foreach(string uid in pop3.GetAll())
    {
        IMail email = new MailBuilder()
            .CreateFromEml(pop3.GetMessageByUID(uid));
          Console.WriteLine( email.Subject );
    }
    pop3.Close(false);      
}

You can download it here: http://www.lesnikowski.com/mail.

Pawel Lesnikowski
Oh, hello! :D Thank you for the link I just visited your? site and am downloading the sample now. Thanks +1
baeltazor
+1  A: 

Hi,

the .NET framework does not support POP3.

Connection to the POP3 server is an easy part of work. The protocol is pretty easy. The problem is correct parsing of the message. You'll need a decent MIME or S/MIME parser which can handle unicode, attachments in vierd formats, message body in nonstandard WinMail.dat produced by Outlook, internationalization issues. A parser which can fix common mail clients bugs and RFC violations etc.. Threre is quite a lot of third party POP3 libraries. There are also some free POP3 libraries on codeproject.

You may try our Rebex POP3 for .NET

// create client, connect and log in  
Pop3 client = new Pop3();
client.Connect("pop3.example.org");
client.Login("username", "password");

// get message list - full headers  
Pop3MessageCollection messages = client.GetMessageList(Pop3ListFields.FullHeaders);

// display info about each message  
Console.WriteLine("UID | From | To | Subject");
foreach (Pop3MessageInfo message in messages)
{
    Console.WriteLine
    (
        "{0} | {1} | {2} | {3}",
        message.UniqueId,
        message.From,
        message.To,
        message.Subject
    );
}

client.Disconnect();

Code is taken from www.rebex.net/secure-mail.net/tutorial-pop3.aspx

Martin Vobr