C# POP/IMAP Mail Client
Switch branches/tags
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Imap reformatting Jun 12, 2015
Properties bump version Jun 11, 2015
Tests reformat Jun 14, 2015
.gitignore further stability and speed improvements May 25, 2014
AE.Net.Mail.csproj remove strong naming May 26, 2014
AE.Net.Mail.nuspec Fix for improperly filtering attachments as attachments instead of al… Feb 8, 2013
AE.Net.Mail.sln Added unit tests, fix for GMail Jul 12, 2011
AE.Net.Mail.vsmdi Added unit tests, fix for GMail Jul 12, 2011
AlternateViewCollection.cs Fix for improperly filtering attachments as attachments instead of al… Feb 8, 2013
Attachment.cs some refactoring Mar 21, 2014
Create-Package.ps1 bump version Jun 30, 2014
HeaderDictionary.cs Handle commas within double quotes Sep 17, 2014
HeaderObject.cs some refactoring Mar 21, 2014
HeaderValue.cs some refactoring Mar 21, 2014
IMailClient.cs Remove Debug.Assert in favor of a warning event; closes #110 Mar 7, 2013
ImapClient.cs Fixed search response parsing May 16, 2018
ImapClientException.cs update formatting Mar 21, 2014
ImapClientExceptionEventArgs.cs update formatting Mar 21, 2014
Local.testsettings Added unit tests, fix for GMail Jul 12, 2011
Logo.png add log; updated nuspec Jan 14, 2011
MailMessage.cs make sure stream is not closed by streamwriter; closes #163 Jun 29, 2014
Pop3Client.cs Wrapped System.Diagnostics.Debugger.Break() into conditional statements. Mar 17, 2015
README.md Update README with correct headers. Oct 26, 2018
SafeDictionary.cs some refactoring Mar 21, 2014
TextClient.cs Ability to setup ServerTimeout for GetResponse. Feb 25, 2015
TraceAndTestImpact.testsettings Added unit tests, fix for GMail Jul 12, 2011
Utilities.cs Fix bug with 24 format Feb 23, 2015
WarningEventArgs.cs Remove Debug.Assert in favor of a warning event; closes #110 Mar 7, 2013

README.md

AE.Net.Mail

A C# POP/IMAP client library

Background

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

IMAP

using(var imap = new AE.Net.Mail.ImapClient(host, username, password, AE.Net.Mail.ImapClient.AuthMethods.Login, port, isSSL))            {
    var msgs = imap.SearchMessages(
      SearchCondition.Undeleted().And(
        SearchCondition.From("david"), 
        SearchCondition.SentSince(new DateTime(2000, 1, 1))
      ).Or(SearchCondition.To("andy"))
    );
      
    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!");
    };
}

POP

 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!
   }
}

Installation

Install-Package AE.Net.Mail

License

http://andyedinborough.mit-license.org/