I have a web application that requires the server component to periodically access POP3 mailboxes and receive emails. Then, the service needs to process emails, which will include:
- Checking email against some business rules (does it contain a valid link in the subject line that the user sent, etc.).
- Analysis and saving of any attachments to disk
- Take email and attachment data and create a new item in the database
- Or update an existing item where the link matches the subject line of the incoming message
What is the best way to approach this? I really don't want to write a POP3 client from scratch, but I need to set up email processing. Ideally, I could connect some component that does access and search for me, returning arrays of attachments, text text, a subject line, etc., Ready for my processing ...
[UPDATE: reviews]
OK, so I spent a lot of time learning (mostly free) .NET POP3 libraries, so I decided to give a brief overview of some of the following and a few others:
- Pop3.net - for free - works fine, very simple, in terms of functionality. This is pretty much just POP3 commands and some base64 encoding, but it is very simple - perhaps a good introduction.
- Pop3 Wizard - commercial / some open source - could not build it, skipping the DLL, I would not worry about it
- C # Mail - free for personal use - works well, comes with a Mime parser and SMTP client, however the comments are in Japanese (not a big deal), and it did not work with SSL βout of the boxβ - I had to change the constructor SslStream after which it did not work.
- OpenPOP - for free - has not been updated for about 5 years, so the current state of .NET 1.0 does not support SSL, but this is not a problem to solve - I just replaced the existing SslStream stream and it worked. Comes with a Mime parser.
From free libraries I would go to C # Mail or OpenPOP.
I looked at several commercial libraries: Chillkat , Rebex , RemObjects , JMail.net . Based on the characteristics, price and experience of the company, I will probably go to Rebex in the future if my requirements change or I encounter production problems with C # Mail or OpenPOP.
In case someone needs it, this is the SslStream replacement constructor that I used to enable SSL with C # Mail and OpenPOP:
SslStream stream = new SslStream(clientSocket.GetStream(), false, delegate(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors errors) { return true; });
flesh Oct 25 '08 at 13:09 2008-10-25 13:09
source share