Recommendations for a .NET component to access an email inbox [closed]

I've been asked to write a Windows service in C# to periodically monitor an email inbox and insert the details of any messages received into a database table.

My instinct is to do this via POP3 and sure enough, Googling for ".NET POP3 component" produces countless (ok, 146,000) results.

Has anybody done anything similar before and can you recommend a decent component that won't break the bank (a few hundred dollars maximum)?

Would there be any benefits to using IMAP rather than POP3?


Solution 1:

With IMAP protocol you can access sub folders, and set message status (seen/unseen), also you can use IDLE feature for instant notifications.

Mail.dll includes POP3, IMAP, SMTP components with SSL support and powerful MIME parser:

using(Imap imap = new Imap())
{
    imap.Connect("imap.server.com");    // or ConnectSSL for SSL
    imap.Login("user", "password");

    imap.SelectInbox();
    List<long> uids = imap.Search(Flag.Unseen);
    foreach (long uid in uids)
    {
        IMail mail = new MailBuilder()
            .CreateFromEml(imap.GetMessageByUID(uid));
        Console.WriteLine(mail.Subject);
    }
    imap.Close();
}

Please note that this is commercial product that I've created.

You can download it at https://www.limilabs.com/mail

Solution 2:

I use the free and open source SharpMimeTools in my application, BugTracker.NET. It has been very dependable:

http://anmar.eu.org/projects/sharpmimetools/

See the files POP3Client.cs, POP3Main.cs, and insert_bug.aspx