<p>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.</p>

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

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

<p>Would there be any benefits to using IMAP rather than POP3?</p>

[{'answer_id': 18021, 'author': 'Sven Hecht', 'author_id': 1168, 'author_profile': 'https://Stackoverflow.com/users/1168', 'pm_score': 0, 'selected': False, 'text': '<p>How about WCF? It\'s free.</p>\n\n<p>If you have an Exchange server:\n<a href="http://msdn.microsoft.com/en-us/library/bb397812.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/bb397812.aspx</a></p>\n\n<p>an example for pop3:\n<a href="http://bartdesmet.net/blogs/bart/archive/2006/09/13/4417.aspx" rel="nofollow noreferrer">http://bartdesmet.net/blogs/bart/archive/2006/09/13/4417.aspx</a></p>\n'}, {'answer_id': 18033, 'author': 'Kibbee', 'author_id': 1862, 'author_profile': 'https://Stackoverflow.com/users/1862', 'pm_score': 3, 'selected': True, 'text': '<p>I recomment <a href="http://www.chilkatsoft.com" rel="nofollow noreferrer">chilkat</a>.  They have pretty stable components, and you can get their email component for as cheap as $99 for a single developer.  Personally, I think going with the whole package of components is a better deal, as it\'s only $289, and comes with many useful components.  I\'m not affiliated with them in any way, although I probably sound like I am.</p>\n'}, {'answer_id': 119633, 'author': 'Corey Trager', 'author_id': 9328, 'author_profile': 'https://Stackoverflow.com/users/9328', 'pm_score': 3, 'selected': False, 'text': '<p>I use the free and open source SharpMimeTools in my application, BugTracker.NET.  It has been very dependable:</p>\n\n<p><a href="http://anmar.eu.org/projects/sharpmimetools/" rel="noreferrer">http://anmar.eu.org/projects/sharpmimetools/</a></p>\n\n<p>See the files POP3Client.cs, POP3Main.cs, and insert_bug.aspx</p>\n'}, {'answer_id': 151861, 'author': 'Mauricio Scheffer', 'author_id': 21239, 'author_profile': 'https://Stackoverflow.com/users/21239', 'pm_score': 1, 'selected': False, 'text': '<p><a href="http://www.lumisoft.ee/lsWWW/Download/Downloads/Net/" rel="nofollow noreferrer">Lumisoft</a> is open-source and includes IMAP and POP clients (among other stuff). I\'ve been using them for years with no problems.</p>\n'}, {'answer_id': 520321, 'author': 'splattne', 'author_id': 6461, 'author_profile': 'https://Stackoverflow.com/users/6461', 'pm_score': 2, 'selected': False, 'text': '<p>I would recommend <a href="http://www.advancedintellect.com/" rel="nofollow noreferrer">AdvancedIntellect</a>. There are components for POP3 and IMAP (ASPNetPOP3 and ASPNetIMAP). Good quality and very responsive support - I remember receiving replies to my questions on a weekend.</p>\n'}, {'answer_id': 1603954, 'author': 'John K', 'author_id': 179972, 'author_profile': 'https://Stackoverflow.com/users/179972', 'pm_score': 2, 'selected': False, 'text': '<p>If you use an open source POP3 implementation or something freely available then you will have access to modify the code and expand it in the direction needed. A quick Google resulted in this C# <a href="http://www.codeproject.com/KB/IP/popapp.aspx" rel="nofollow noreferrer">POP3 code from Code Project</a> to retrieve messages.</p>\n\n<p>There\'s something empowering about rolling your own, or at least extending it.</p>\n\n<p><img src="https://www.codeproject.com/KB/IP/POPApp/GUI.gif" alt="alt text"></p>\n'}, {'answer_id': 2383070, 'author': 'Martin Vobr', 'author_id': 16132, 'author_profile': 'https://Stackoverflow.com/users/16132', 'pm_score': 2, 'selected': False, 'text': '<p>You may want to check our <a href="http://www.rebex.net/secure-mail.net/" rel="nofollow noreferrer">Rebex Mail component</a>. It includes <strong>IMAP</strong>, <strong>SMTP</strong>, <strong>POP3</strong> protocols and and <strong>S/MIME</strong> parser.</p>\n\n<p>The <code>POP3</code> does not have a concept of \'unread\' messages or searchig for messages matching specific criteria. <code>POP3</code> simply returns all messages in your inbox.</p>\n\n<p>Using <code>IMAP</code> you can instruct the IMAP server to send you just unread messages, messages which arrived since specified time, messages from specific user etc. You don\'t have to download it all to the client and do the filtering there.</p>\n\n<p>Following code shows how to download unread messages from the <code>Imap</code> server using <code>Rebex.Net.Imap</code> class.</p>\n\n<pre><code>// create client, connect and log in \nImap client = new Imap();\nclient.Connect("imap.example.org");\nclient.Login("username", "password");\n\n// select folder \nclient.SelectFolder("Inbox");\n\n// get message list - envelope headers \nImapMessageCollection messages = client.Search\n  (\n     ImapSearchParameter.HasFlagsNoneOf(ImapMessageFlags.Seen)\n  ); \n\n// display info about each message \nConsole.WriteLine("UID | From | To | Subject");\nforeach (ImapMessageInfo message in messages)\n{\n    Console.WriteLine(\n        "{0} | {1} | {2} | {3}",\n        message.UniqueId,\n        message.From,\n        message.To,\n        message.Subject);\n}\n\n// disconnect \nclient.Disconnect();\n</code></pre>\n\n<p>Example of combining multiple search criteria follows. This will return messages from the last year larger than 100KB.</p>\n\n<pre><code>ImapMessageCollection messages = client.Search\n  (\n     ImapSearchParameter.Arrived(DateTime.Now.AddYears(-1), DateTime.Now),\n     ImapSearchParameter.Size(1024 * 100, Int32.MaxValue)\n  ); \n</code></pre>\n\n<p>You can download the trial from <a href="http://www.rebex.net/secure-mail.net/download.aspx" rel="nofollow noreferrer">rebex.net/secure-mail.net/download.aspx</a></p>\n'}, {'answer_id': 2919687, 'author': 'jmd', 'author_id': 351726, 'author_profile': 'https://Stackoverflow.com/users/351726', 'pm_score': 0, 'selected': False, 'text': "<p>C#Mail cost $0 but is also GNU GPL licenced, so make sure that's OK.</p>\n"}, {'answer_id': 4427982, 'author': 'Pawel Lesnikowski', 'author_id': 80894, 'author_profile': 'https://Stackoverflow.com/users/80894', 'pm_score': 3, 'selected': False, 'text': '<p>With IMAP protocol you can access <strong>sub folders</strong>, and <strong>set message status</strong> (seen/unseen), also you can use <strong>IDLE</strong> feature for instant notifications.</p>\n\n<p><a href="https://www.limilabs.com/mail" rel="nofollow">Mail.dll</a> includes <strong>POP3</strong>, <strong>IMAP</strong>, <strong>SMTP</strong> components with <strong>SSL</strong> support and powerful MIME parser:</p>\n\n<pre><code>using(Imap imap = new Imap())\n{\n    imap.Connect("imap.server.com");    // or ConnectSSL for SSL\n    imap.Login("user", "password");\n\n    imap.SelectInbox();\n    List&lt;long&gt; uids = imap.Search(Flag.Unseen);\n    foreach (long uid in uids)\n    {\n        IMail mail = new MailBuilder()\n            .CreateFromEml(imap.GetMessageByUID(uid));\n        Console.WriteLine(mail.Subject);\n    }\n    imap.Close();\n}\n</code></pre>\n\n<p>Please note that this is commercial product that I\'ve created.</p>\n\n<p>You can download it at <a href="https://www.limilabs.com/mail" rel="nofollow">https://www.limilabs.com/mail</a></p>\n'}, {'answer_id': 16785450, 'author': 'Igor - AfterLogic', 'author_id': 2427314, 'author_profile': 'https://Stackoverflow.com/users/2427314', 'pm_score': 0, 'selected': False, 'text': '<p>You can do this using MailBee.NET Objects: <a href="http://www.afterlogic.com/products/net-email-components" rel="nofollow">http://www.afterlogic.com/products/net-email-components</a></p>\n\n<p>While I\'d recommend to use IMAP indeed, particularly since it offers IDLE support mentioned here already, you could do the same with POP3. There\'s a brief description of both the approaches, and a complete sample for IMAP IDLE scenario:</p>\n\n<p><a href="http://www.afterlogic.com/wiki/Getting_notifications_about_new_messages_in_mailbox_%28IMAP_IDLE_and_polling%29" rel="nofollow">http://www.afterlogic.com/wiki/Getting_notifications_about_new_messages_in_mailbox_%28IMAP_IDLE_and_polling%29</a></p>\n\n<p>Please note that I am affiliated with AfterLogic, and I\'ll be pleased to assist you if you need any help, check Request Support option at our website.</p>\n'}, {'answer_id': 24790657, 'author': 'Falah Abu Hassan', 'author_id': 3430337, 'author_profile': 'https://Stackoverflow.com/users/3430337', 'pm_score': 0, 'selected': False, 'text': "<p>IMAPX2 is the best. Using IMAP you can control the folders in a mail server, a thing you wouldn't be able to do using POP. IMAPX is an open source code you can look into, and is free to use.</p>\n\n<p>IMAPX is straight forward and reliable.</p>\n"}]
['https://Stackoverflow.com/questions/18006', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2084/']