Click or drag to resize
MimeKit

ImapCapabilities Enumeration

Capabilities supported by an IMAP server.

Namespace: MailKit.Net.Imap
Assembly: MailKit (in MailKit.dll) Version: 4.7.1
Syntax
C#
[FlagsAttribute]
public enum ImapCapabilities
Members
Member nameValueDescription
None0 The server does not support any additional extensions.
IMAP41 The server implements the core IMAP4 commands.
IMAP4rev12 The server implements the core IMAP4rev1 commands.
IMAP4rev24 The server implements the core IMAP4rev2 commands described in rfc9051.
Status8 The server supports the STATUS command.
Acl16 The server supports the ACL extension defined in rfc2086 and rfc4314.
Quota32 The server supports the QUOTA extension.
LiteralPlus64 The server supports the LITERAL+ extension.
Idle128 The server supports the IDLE extension.
MailboxReferrals256 The server supports the MAILBOX-REFERRALS extension.
LoginReferrals512 the server supports the LOGIN-REFERRALS extension.
Namespace1,024 The server supports the NAMESPACE extension.
Id2,048 The server supports the ID extension.
Children4,096 The server supports the CHILDREN extension.
LoginDisabled8,192 The server supports the LOGINDISABLED extension.
StartTLS16,384 The server supports the STARTTLS extension.
MultiAppend32,768 The server supports the MULTIAPPEND extension.
Binary65,536 The server supports the BINARY content extension.
Unselect131,072 The server supports the UNSELECT extension.
UidPlus262,144 The server supports the UIDPLUS extension.
Catenate524,288 The server supports the CATENATE extension.
CondStore1,048,576 The server supports the CONDSTORE extension.
ESearch2,097,152 The server supports the ESEARCH extension.
SaslIR4,194,304 The server supports the SASL-IR extension.
Compress8,388,608 The server supports the COMPRESS extension.
Within16,777,216 The server supports the WITHIN extension.
Enable33,554,432 The server supports the ENABLE extension.
QuickResync67,108,864 The server supports the QRESYNC extension.
SearchResults134,217,728 The server supports the SEARCHRES extension.
Sort268,435,456 The server supports the SORT extension.
Thread536,870,912 The server supports the THREAD extension.
Annotate1,073,741,824 The server supports the ANNOTATE extension.
ListExtended2,147,483,648 The server supports the LIST-EXTENDED extension.
Convert4,294,967,296 The server supports the CONVERT extension.
Language8,589,934,592 The server supports the LANGUAGE extension.
I18NLevel17,179,869,184 The server supports the I18NLEVEL extension.
ESort34,359,738,368 The server supports the ESORT extension.
Context68,719,476,736 The server supports the CONTEXT extension.
Metadata137,438,953,472 The server supports the METADATA extension.
MetadataServer274,877,906,944 The server supports the METADATA-SERVER extension.
Notify549,755,813,888 The server supports the NOTIFY extension.
Filters1,099,511,627,776 The server supports the FILTERS extension.
ListStatus2,199,023,255,552 The server supports the LIST-STATUS extension.
SortDisplay4,398,046,511,104 The server supports the SORT=DISPLAY extension.
CreateSpecialUse8,796,093,022,208 The server supports the CREATE-SPECIAL-USE extension.
SpecialUse17,592,186,044,416 The server supports the SPECIAL-USE extension.
FuzzySearch35,184,372,088,832 The server supports the SEARCH=FUZZY extension.
MultiSearch70,368,744,177,664 The server supports the MULTISEARCH extension.
Move140,737,488,355,328 The server supports the MOVE extension.
UTF8Accept281,474,976,710,656 The server supports the UTF8=ACCEPT extension.
UTF8Only562,949,953,421,312 The server supports the UTF8=ONLY extension.
LiteralMinus1,125,899,906,842,624 The server supports the LITERAL- extension.
AppendLimit2,251,799,813,685,248 The server supports the APPENDLIMIT extension.
Unauthenticate4,503,599,627,370,496 The server supports the UNAUTHENTICATE extension.
StatusSize9,007,199,254,740,992 The server supports the STATUS=SIZE extension.
ListMyRights18,014,398,509,481,984 The server supports the LIST-MYRIGHTS extension.
ObjectID36,028,797,018,963,968 The server supports the OBJECTID extension.
Replace72,057,594,037,927,936 The server supports the REPLACE extension.
SaveDate144,115,188,075,855,872 The server supports the SAVEDATE extension.
Preview288,230,376,151,711,744 The server supports the PREVIEW extension.
XList1,152,921,504,606,846,976 The server supports the XLIST extension (GMail).
GMailExt12,305,843,009,213,693,952 The server supports the X-GM-EXT1 extension (GMail).
Remarks
Capabilities are read as part of the response to the CAPABILITY command that is issued during the connection and authentication phases of the ImapClient.
Example
C#
public static void Capabilities ()
{
    using (var client = new ImapClient ()) {
        client.Connect ("imap.gmail.com", 993, SecureSocketOptions.SslOnConnect);

        var mechanisms = string.Join (", ", client.AuthenticationMechanisms);
        Console.WriteLine ("The IMAP server supports the following SASL authentication mechanisms: {0}", mechanisms);

        client.Authenticate ("username", "password");

        if (client.Capabilities.HasFlag (ImapCapabilities.Id)) {
            var clientImplementation = new ImapImplementation { Name = "MailKit", Version = "1.0" };
            var serverImplementation = client.Identify (clientImplementation);

            Console.WriteLine ("Server implementation details:");
            foreach (var property in serverImplementation.Properties)
                Console.WriteLine ("  {0} = {1}", property.Key, property.Value);
        }

        if (client.Capabilities.HasFlag (ImapCapabilities.Acl)) {
            Console.WriteLine ("The IMAP server supports Access Control Lists.");

            Console.WriteLine ("The IMAP server supports the following access rights: {0}", client.Rights);

            Console.WriteLine ("The Inbox has the following access controls:");
            var acl = client.Inbox.GetAccessControlList ();
            foreach (var ac in acl)
                Console.WriteLine ("  {0} = {1}", ac.Name, ac.Rights);

            var myRights = client.Inbox.GetMyAccessRights ();
            Console.WriteLine ("Your current rights for the Inbox folder are: {0}", myRights);
        }

        if (client.Capabilities.HasFlag (ImapCapabilities.Quota)) {
            Console.WriteLine ("The IMAP server supports quotas.");

            Console.WriteLine ("The current quota for the Inbox is:");
            var quota = client.Inbox.GetQuota ();

            if (quota.StorageLimit.HasValue)
                Console.WriteLine ("  Limited by storage space. Using {0} out of {1} bytes.", quota.CurrentStorageSize.Value, quota.StorageLimit.Value);

            if (quota.MessageLimit.HasValue)
                Console.WriteLine ("  Limited by the number of messages. Using {0} out of {1} bytes.", quota.CurrentMessageCount.Value, quota.MessageLimit.Value);

            Console.WriteLine ("The quota root is: {0}", quota.QuotaRoot);
        }

        if (client.Capabilities.HasFlag (ImapCapabilities.Thread)) {
            if (client.ThreadingAlgorithms.Contains (ThreadingAlgorithm.OrderedSubject))
                Console.WriteLine ("The IMAP server supports threading by subject.");
            if (client.ThreadingAlgorithms.Contains (ThreadingAlgorithm.References))
                Console.WriteLine ("The IMAP server supports threading by references.");
        }

        client.Disconnect (true);
    }
}
See Also