Skip to content


Subversion checkout URL

You can clone with
Download ZIP
C# POP/IMAP Mail Client
C# PowerShell
Latest commit d8ad4fa @andyedinborough Merge pull request #188 from Geograph-us/patch-1
Update ImapClient.cs
Failed to load latest commit information.
Imap reformatting
Properties bump version
Tests reformat
.gitignore further stability and speed improvements
AE.Net.Mail.csproj remove strong naming
AE.Net.Mail.nuspec Fix for improperly filtering attachments as attachments instead of al…
AE.Net.Mail.sln Added unit tests, fix for GMail
AE.Net.Mail.vsmdi Added unit tests, fix for GMail
AlternateViewCollection.cs Fix for improperly filtering attachments as attachments instead of al…
Attachment.cs some refactoring
Create-Package.ps1 bump version
HeaderDictionary.cs Handle commas within double quotes
HeaderObject.cs some refactoring
HeaderValue.cs some refactoring
IMailClient.cs Remove Debug.Assert in favor of a warning event; closes #110
ImapClient.cs Update ImapClient.cs
ImapClientException.cs update formatting
ImapClientExceptionEventArgs.cs update formatting
Local.testsettings Added unit tests, fix for GMail
Logo.png add log; updated nuspec
MailMessage.cs make sure stream is not closed by streamwriter; closes #163
Pop3Client.cs Wrapped System.Diagnostics.Debugger.Break() into conditional statements. Added nuget package reference to
SafeDictionary.cs some refactoring
TextClient.cs Ability to setup ServerTimeout for GetResponse.
TraceAndTestImpact.testsettings Added unit tests, fix for GMail
Utilities.cs Fix bug with 24 format
WarningEventArgs.cs Remove Debug.Assert in favor of a warning event; closes #110


A C# POP/IMAP client library


These are text-based services... it's not that hard, and yet all the projects I found out there were nasty, bloated, and severely error prone. So, I rebuilt one. This is based heavily on xemail-net. I simplified it quite a bit, and created standard methods for repeated code blocks and implemented a base class to simplify the creation of the Pop3 client.

Sample Usage


 using(var imap = new AE.Net.Mail.ImapClient(host, username, password, AE.Net.Mail.ImapClient.AuthMethods.Login, port, isSSL)) {
    var msgs = imap.SearchMessages(
        SearchCondition.SentSince(new DateTime(2000, 1, 1))

    Assert.AreEqual(msgs[0].Value.Subject, "This is cool!");

    imap.NewMessage += (sender, e) => {
      var msg = imap.GetMessage(e.MessageCount - 1);
      Assert.AreEqual(msg.Subject, "IDLE support?  Yes, please!");


 using(var pop = new AE.Net.Mail.Pop3Client(host, username, password, port, isSSL)) {
   for(var i = pop.GetMessageCount() - 1; i >= 0; i--){
      var msg = pop.GetMessage(i, false);
      Assert.AreEqual(msg.Subject, "Standard API between different protocols?  Yes, please!");
      pop.DeleteMessage(i); //WE DON'T NEED NO STINKIN' EMAIL!


Install-Package AE.Net.Mail


Something went wrong with that request. Please try again.