SMTP Service Extension for Returning Enhanced Error Codes
Extracted elements (11)
Client negotiation was intentionally omitted: because SMTP server error code implementation is generally poor, the authors concluded that any improvement toward comprehensible error codes should benefit all clients, extended or not, without requiring a client request.
Unlike most SMTP extensions where the client must make an explicit request before the server behaves differently, ENHANCEDSTATUSCODES servers return enhanced codes unconditionally; legacy clients that do not send EHLO still receive the augmented responses.
3xx SMTP responses are explicitly excluded from the requirement to carry enhanced status codes; only 2xx, 4xx, and 5xx responses (outside of greeting and HELO/EHLO) are in scope.
Servers supporting Enhanced-Status-Codes MUST preface the text part of all 2xx, 4xx, and 5xx response lines (except the initial greeting and responses to HELO or EHLO) with a conforming status code.
Servers supporting this extension MUST attach enhanced status codes to their responses regardless of whether the client used EHLO; no client-side negotiation or opt-in is required.
The enhanced status code embedded in a response MUST agree with the primary SMTP response code: a 2xx response must carry a 2.X.X code, 4xx must carry 4.X.X, and 5xx must carry 5.X.X.
The no-negotiation approach used here MUST NOT be taken as a license for future SMTP extensions to change client-server interaction without proper server announcement and a corresponding enabling client command.
When a response spans multiple lines, the same enhanced status code MUST appear at the beginning of the text in each line of the multi-line response.
The SMTP service extension is named 'Enhanced-Status-Codes' and advertised via the EHLO keyword ENHANCEDSTATUSCODES. No parameters are used with the keyword and no additional SMTP verbs are defined.
Additional detail in server responses provides additional information about the server that could assist in circumventing server security. Implementors must weigh the benefit of richer error information against the risk of information disclosure.
Enhanced status codes have the syntax 'class "." subject "." detail' where class is '2', '4', or '5'; subject is 1–3 digits; and detail is 1–3 digits. The code is always followed by one or more spaces before the response text.