Skip to content


Subversion checkout URL

You can clone with
Download ZIP
A free, easy-to-use and well-documented .NET library component for communicating with IMAP servers
Latest commit 874de53 @smiley22 Deal with comments, unit tests
- Deal with comments + unit tests.
- Version
Failed to load latest commit information.
Auth Support for .NET 3.5
Bodystructure Use InnerException to get the original error.
Properties Deal with comments, unit tests
Tests Deal with comments, unit tests
.gitattributes initial commit
.gitignore Minor Bugfix SetAddressFields
AuthMethod.cs Bugfix EventDispatcher Markdown woes
Examples.xml API changes, refactoring
Exceptions.cs Refactoring, Cleanup, Comments
FetchOptions.cs Refactoring, Cleanup, Comments
IImapClient.cs Bugfix IdleLoop
IdleErrorEventArgs.cs Bugfix IdleLoop
IdleMessageEventArgs.cs Bugfix IdleLoop
ImapClient.cs Bugfix EventDispatcher Bugfix BuildHeader
MIMEPart.cs Refactoring, Cleanup, Comments
MailMessage.cs Deal with comments, unit tests
MailboxFlags.cs Refactoring, Cleanup, Comments
MailboxInfo.cs Refactoring, Cleanup, Comments
MailboxQuota.cs Refactoring, Cleanup, Comments
MailboxStatus.cs Refactoring, Cleanup, Comments
MessageBuilder.cs Deal with comments, unit tests
MessageFlags.cs Refactoring, Cleanup, Comments Deal with comments, unit tests
S22.Imap.csproj Bugfix IdleLoop
S22.Imap.sln Change TargetFrameworkVersion to 4.0 to run tests in VS2010
SafeQueue.cs Refactoring, Cleanup, Comments
SearchCondition.cs Support for .NET 3.5
Util.cs Improved handling of encoded-words


This repository contains an easy-to-use and well-documented .NET assembly for communicating with and receiving electronic mail from an Internet Message Access Protocol (IMAP) server.


You can always get the latest package on Nuget (includes .NET 4.0 and 3.5 binaries) or download the binaries (targeting .NET 4.0) as a .zip archive from here. The documentation is also available for offline viewing as HTML or CHM and can be downloaded from here and here, respectively.

Usage & Examples

To use the library add the S22.Imap.dll assembly to your project references in Visual Studio. Here's a simple example that initializes a new instance of the ImapClient class and connects to Gmail's IMAP server:

using System;
using S22.Imap;

namespace Test {
    class Program {
        static void Main(string[] args) {
            // Connect on port 993 using SSL.
            using (ImapClient Client = new ImapClient("", 993, true))
                Console.WriteLine("We are connected!");

Here are a couple of examples of how to use the library. Please also see the documentation for further details on using the classes and methods exposed by the S22.Imap namespace.


  • Supports IMAP IDLE notifications
  • Supports IMAP over SSL
  • API designed to be very easy to use
  • Allows selectively fetching parts of mail messages
  • Inherently thread-safe
  • Well documented with lots of example code
  • Robust MIME parser, tested with 100.000+ mails
  • Supports various authentication mechanisms (SCRAM-SHA-1, OAUTH2, NTLM among others)
  • Integrates well with existing System.Net.Mail infrastructure
  • Still supports .NET 3.5
  • Free to use in commercial and personal projects (MIT license)


This library is copyright © 2012-2014 Torben Könke.

Parts of this library are based on the AE.Net.Mail project (copyright © 2012 Andy Edinborough).


This library is released under the MIT license.

Bug reports

Please send your bug reports to or create a new issue on the GitHub project homepage.

Something went wrong with that request. Please try again.