IMAP component for .NET
Recently Mail.dll email component got new IMAP client. IMAP, short for Internet Message Access Protocol, is one of the two most prevalent Internet standard protocols for e-mail retrieval, the other being the Post Office Protocol (POP3). IMAP has many advantages over POP3.
The simplest code to access IMAP server looks as follows:
using(Imap imap = new Imap())
{
imap.Connect("imap.server.com");
imap.Login("user", "password");
imap.SelectInbox();
List<long> uids = imap.SearchFlag(Flag.Unseen);
foreach (long uid in uids)
{
IMail mail = new MailBuilder()
.CreateFromEml(imap.GetMessageByUID( uid ));
Console.WriteLine(mail.Subject);
}
imap.Close();
}
and for those who like VB.NET more:
Using imap As New Imap()
imap.Connect("imap.server.com")
imap.Login("user", "password")
imap.SelectInbox()
Dim uids As List(Of Long) = imap.SearchFlag(Flag.Unseen)
For Each uid As Long In uids
Dim mail As IMail = New MailBuilder()_
.CreateFromEml(imap.GetMessageByUID(uid))
Console.WriteLine(mail.Subject)
Next
imap.Close()
End Using
You can’t get much simpler than that!
All necessary IMAP features are there:
- Create, Delete and Rename folders
- Download and upload emails
- Move and copy email messages between folders
- Flagging messages
- Powerful search, with great syntax
- And of course fully tested Mail.dll email parser
It works perfectly with Exchange, Gmail and all other IMAP servers.
If you like it, just give it a try and download it at: Mail.dll .NET IMAP component