Code Monkey home page Code Monkey logo

aenetmail's Introduction

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/

aenetmail's People

Contributors

andyedinborough avatar technicallyfeasible avatar kivikakk avatar moonpyk avatar filpen avatar jvdvleuten avatar rix0rrr avatar robitar avatar rflipper avatar warrenfalk avatar petersondrew avatar philipspigelmire avatar kuttkatrea avatar thefra985 avatar geograph-us avatar ignacionr avatar jorgef avatar joshilewis avatar mungojam avatar miguelerm avatar nwoolls avatar nicolas01 avatar ilivewithian avatar b2berry avatar deaquino avatar gymbrall avatar nikolausm avatar piher avatar paolosanchi avatar summercat avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.