{"record":{"id":"0e8b60a8177ff3cf","repo":"jstedfast/MailKit","slug":"the-pop3-server-does-not-support-the-lang-extension","errorCode":null,"errorMessage":"The POP3 server does not support the LANG extension.","messagePattern":"The POP3 server does not support the LANG extension\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"MailKit/Net/Pop3/Pop3Client.cs","lineNumber":1677,"sourceCode":"\t\t{\n\t\t\tif (pc.Status != Pop3CommandStatus.Ok)\n\t\t\t\treturn Task.CompletedTask;\n\n\t\t\tif (doAsync)\n\t\t\t\treturn ReadLangResponseAsync (engine, pc, cancellationToken);\n\n\t\t\tReadLangResponse (engine, pc, cancellationToken);\n\n\t\t\treturn Task.CompletedTask;\n\t\t}\n\n\t\tPop3Command QueueLangCommand (out List<Pop3Language> langs)\n\t\t{\n\t\t\tCheckDisposed ();\n\t\t\tCheckConnected ();\n\n\t\t\tif ((Capabilities & Pop3Capabilities.Lang) == 0)\n\t\t\t\tthrow new NotSupportedException (\"The POP3 server does not support the LANG extension.\");\n\n\t\t\tvar pc = engine.QueueCommand (ProcessLangResponse, \"LANG\\r\\n\");\n\t\t\tpc.UserData = langs = new List<Pop3Language> ();\n\n\t\t\treturn pc;\n\t\t}\n\n\t\t/// <summary>\n\t\t/// Get the list of languages supported by the POP3 server.\n\t\t/// </summary>\n\t\t/// <remarks>\n\t\t/// If the POP3 server supports the LANG extension, it is possible to\n\t\t/// query the list of languages supported by the POP3 server that can\n\t\t/// be used for error messages.\n\t\t/// </remarks>\n\t\t/// <returns>The supported languages.</returns>\n\t\t/// <param name=\"cancellationToken\">The cancellation token.</param>\n\t\t/// <exception cref=\"System.ObjectDisposedException\">","sourceCodeStart":1659,"sourceCodeEnd":1695,"githubUrl":"https://github.com/jstedfast/MailKit/blob/9d3859a7855e3e17582c07fd01972b8e262bf176/MailKit/Net/Pop3/Pop3Client.cs#L1659-L1695","documentation":"Pop3Client.GetLanguages queues a LANG command and throws this NotSupportedException when the server did not advertise the LANG capability (RFC 8158) in CAPA. Without that capability the server cannot report the languages it supports for error messages, so MailKit refuses the request up front.","triggerScenarios":"Calling GetLanguages/GetLanguagesAsync on a POP3 server without LANG support; servers that predate RFC 8158 or embedded servers that omit the extension.","commonSituations":"Localizing server error messages against legacy ISP POP3 servers; code that unconditionally calls GetLanguages after connect; minimal Docker/appliance mail servers.","solutions":["Check client.Capabilities.HasFlag (Pop3Capabilities.Lang) before calling GetLanguages and skip if absent.","Catch NotSupportedException and proceed with default (English) server messages.","Upgrade the POP3 server to one implementing RFC 8158 if language negotiation is required.","Only call GetLanguages when localization of server errors is actually needed."],"exampleFix":"// before\nvar langs = client.GetLanguages (cancellationToken);\n// after\nif (client.Capabilities.HasFlag (Pop3Capabilities.Lang)) {\n    var langs = client.GetLanguages (cancellationToken);\n}","handlingStrategy":"validation","validationCode":"bool langSupported = client.Capabilities.HasFlag (Pop3Capabilities.Lang);\nif (!langSupported)\n    return new List<Pop3Language> (); // server default only","typeGuard":null,"tryCatchPattern":"try {\n    var langs = client.GetLanguages (cancellationToken);\n} catch (NotSupportedException) {\n    var langs = null; // server does not support LANG; assume English/default\n}","preventionTips":["Gate RFC 8158 APIs (GetLanguages/SetLanguage) on Pop3Capabilities.Lang","Design localization as optional: fall back to server default messages","Test against a minimal POP3 daemon to catch unconditional extension usage"],"tags":["pop3","lang","capability","mailkit","localization"],"backgroundTag":"feature-not-enabled","analyzedSha":"9d3859a7855e3e17582c07fd01972b8e262bf176","analyzedAt":"2026-09-15T15:46:11.592Z","contentChangedAt":"2026-09-15T15:46:11.592Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}