jstedfast/MailKit · warning · NotSupportedException

The IMAP server does not support the ID extension.

Error message

The IMAP server does not support the ID extension.

What it means

ImapClient.Identify sends the IMAP ID command (RFC 2971) to exchange client/server implementation info. MailKit throws this NotSupportedException when the server did not advertise the ID capability, since the command would be rejected by the server anyway.

Solutions

  1. Check (client.Capabilities & ImapCapabilities.Id) != 0 before calling Identify
  2. Skip identification gracefully — it is optional per RFC 2971 and not required for normal operation
  3. If server identification is needed for debugging, use a server that supports ID or inspect IMAP greeting/capabilities instead

Example fix

// before
client.Identify (new ImapImplementation { Name = "MyApp" });
// after
if ((client.Capabilities & ImapCapabilities.Id) != 0)
    client.Identify (new ImapImplementation { Name = "MyApp" });
Defensive patterns

Strategy: validation

Validate before calling

if ((client.Capabilities & ImapCapabilities.Id) != 0) client.Identify (impl);

Type guard

bool SupportsId (ImapClient c) => (c.Capabilities & ImapCapabilities.Id) != 0;

Try / catch

try { client.Identify (impl); } catch (NotSupportedException) { /* server lacks RFC 2971 ID; skip identification */ }

Prevention

When it happens

Trigger: Calling Identify(...) (via QueueIdentifyCommand) while (engine.Capabilities & ImapCapabilities.Id) == 0 — server CAPABILITY lacks ID.

Common situations: Calling Identify on servers that don't support RFC 2971 (many consumer IMAP servers); sending client info unconditionally in setup code; some servers also block ID to hide software versions.

Related errors


AI-assisted analysis of jstedfast/MailKit@9d3859a785 (2026-09-15). Data as JSON: /api/errors/7c7f517f007131a8. Report an issue: GitHub.

Appendix: source

Thrown at MailKit/Net/Imap/ImapClient.cs:524

		/// An IMAP protocol error occurred.
		/// </exception>
		public void EnableUTF8 (CancellationToken cancellationToken = default)
		{
			if (!TryQueueEnableUTF8Command (cancellationToken, out var ic))
				return;

			engine.Run (ic);

			ProcessEnableResponse (ic);
		}

		ImapCommand QueueIdentifyCommand (ImapImplementation clientImplementation, CancellationToken cancellationToken)
		{
			CheckDisposed ();
			CheckConnected ();

			if ((engine.Capabilities & ImapCapabilities.Id) == 0)
				throw new NotSupportedException ("The IMAP server does not support the ID extension.");

			var command = new StringBuilder ("ID ");
			var args = new List<object> ();

			if (clientImplementation != null && clientImplementation.Properties.Count > 0) {
				command.Append ('(');
				foreach (var property in clientImplementation.Properties) {
					command.Append ("%Q ");
					args.Add (property.Key);

					if (property.Value != null) {
						command.Append ("%Q ");
						args.Add (property.Value);
					} else {
						command.Append ("NIL ");
					}
				}
				command[command.Length - 1] = ')';

View on GitHub (pinned to 9d3859a785)