RFC 9422

The LIMITS SMTP Service Extension

πŸ“… published February 2024, from ietf

RFC 9422: The LIMITS SMTP Service Extension πŸŽ€

Okay bestie, this one is RFC 9422, and it's giving main character energy in email land πŸ’Œβœ¨

Who wrote it: N. Freed and J. Klensin πŸ’… Category: Standards Track, which is an Internet Standards Track document πŸ”₯ Date: February 2024 🌸 ISSN: 2070-1721 Obsoletes / Updates: The title block doesn't list anything it obsoletes or updates πŸ™ˆ Published by: Internet Engineering Task Force (IETF) πŸ¦‹


Abstract ✨

Okay so this doc defines a LIMITS extension for SMTP (including submission) and for LMTP too πŸ’– It also defines an associated limit registry πŸ“š The extension lets an SMTP, submission, or LMTP server tell the client what limits it plans to apply during the current session. Then the client can adapt its behavior to stay within those limits. Iconic, honestly πŸ‘‘

Status of This Memo πŸ“œ

This is an Internet Standards Track document. ✨

This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). If you want more info on Internet Standards, check out Section 2 of RFC 7841 🧚

Info about the current status of this document, any errata, and how to send feedback on it is at https://www.rfc-editor.org/info/rfc9422 πŸ”—

Copyright (c) 2024 IETF Trust and the persons identified as the document authors. All rights reserved.

This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) as in effect on the date of publication of this document. Please read these carefully, because they describe your rights and restrictions for this document. Code Components extracted from this document must include Revised BSD License text as described in Section 4.e of the Trust Legal Provisions, and they're provided without warranty as described in the Revised BSD License πŸ™

Table of Contents πŸ—‚οΈ

1.  Introduction
2.  Terminology
3.  The LIMITS SMTP Extension
  3.1.  Limits
  3.2.  Limit Naming Conventions
  3.3.  Interaction with Pipelining
  3.4.  Varying Limits
  3.5.  Interaction with SMTP Minimums
  3.6.  Multiple EHLO Commands
  3.7.  Syntax Errors in the LIMITS Parameter Value
  3.8.  Caching of Limit Settings between Sessions Involving the
        Same Client and Server SMTP
4.  Initial Limits
  4.1.  MAILMAX Limit
  4.2.  RCPTMAX Limit
  4.3.  RCPTDOMAINMAX Limit
5.  Example
6.  Security Considerations
7.  IANA Considerations
  7.1.  SMTP Service Extension Registry
  7.2.  SMTP Server Limits Registry
8.  References
  8.1.  Normative References
  8.2.  Informative References
Acknowledgments
Authors' Addresses

1. Introduction 🌈

Okay so SMTP lets you transfer [SMTP] or submit [SUBMIT] multiple email messages from one host to another, each with one or more recipients, over a single connection or multiple connections πŸ“¨

LMTP [LMTP] is the one that lets you deliver messages to a system that doesn't have its own mail queues 🧚 Just like SMTP, it allows multiple messages with multiple recipients.

Here's the thing: servers need to enforce limits on different parts of the protocol so they don't waste resources and can protect themselves from malicious clients πŸ›‘οΈ For example, there could be a limit on how many recipients you can list in one transaction πŸ™ˆ

Servers may also want to change their limits depending on how they feel about a particular client's reputation πŸ‘€

Now the problem is that these limits can vary, so clients can accidentally go over a server's limit. The server then responds with a temporary error (or sometimes a permanent one πŸ’€), and that can mean delays or even failed message transfers. Not it 😭

This is where the LIMITS extension comes in ✨ It lets a server tell the client about specific limits in effect for a particular SMTP or LMTP session, right in the response to the EHLO or LHLO command. With that info plus the inherent flexibility of these protocols, clients can avoid those server errors and the chaos they cause 🫢

Servers could always announce a limit with special syntax in a reply, but that approach means the client has to issue a command first. This mechanism skips that overhead by announcing the limits before any real back-and-forth happens πŸ¦‹

Limits get registered with the IANA. Each registration includes the limit name, the value syntax, and a description of what it means πŸ“š

2. Terminology πŸ’…

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here. So capitals = the real rules, lowercase = just vibes πŸŽ€

This spec uses the Augmented Backus-Naur Form [ABNF] notation and its core rules to define the formal syntax of the LIMITS extension πŸ”

This spec makes heavy use of the terminology defined and used in [SMTP] πŸ“–

3. The LIMITS SMTP Extension πŸ¦‹

The extension mechanism for SMTP is defined in Section 2.2 of the current SMTP specification [RFC5321a]. LMTP [LMTP] inherits SMTP's extension mechanism too πŸ™Œ

The name of the extension is LIMITS. Servers that implement this extension advertise LIMITS as a keyword in the response to EHLO (LHLO for LMTP). The associated parameter is how the server tells the client about one or more limits, each with an optional value. The syntax of the parameter is:

  limits-param = limit-name-value 0*[SP limit-name-value]
  limit-name-value = limit-name ["=" limit-value]
  limit-name = 1*(ALPHA / DIGIT / "-" / "_")
  limit-value = 1*(%x21-3A / %x3C-7E) ; Any VCHAR except ";"

This extension adds no new SMTP commands and doesn't change any existing command. Plot twist, though: a LIMITS parameter could be tied to another SMTP extension that does those things πŸ‘€

3.1. Limits 🧁

To keep behavior consistent, every limit MUST be registered with the IANA, as described below. No freelancing allowed πŸ™…β€β™€οΈ

3.2. Limit Naming Conventions ✏️

Limit names MUST be comprehensible, but they should also be kept as short as possible. Using commonly understood abbreviations, e.g., "MAX" for "maximum", is encouraged. Abbreviation queen πŸ‘‘

When a limit is tied to a particular command, its name SHOULD begin with the name of that command.

Limit names SHOULD end with one or more terms that describe the type of limit.

3.3. Interaction with Pipelining πŸš€

The "Pipelining" extension [PIPELINING] is commonly used to boost performance, especially over high-latency connections. Pipelining lets an entire transaction get sent without checking responses, and in some cases it may be possible to send multiple transactions at once 🏎️

Here's why pipelining matters for LIMITS 🀯 A pipelining client can't check intermediate command responses without stalling the pipeline. That means it can't count how many responses were successful versus failed and adjust its behavior on the fly. Limit designers need to keep this in mind 🧠

For example, you might think it'd be better to limit the number of successful RCPT TO commands, instead of the way the RCPTMAX limit is specified in Section 4.2 below. But counting the total number of RCPT TO commands is simple, while counting the successful ones stalls the pipeline. So the simple version wins πŸ’…

3.4. Varying Limits 🌊

This extension provides an announcement as part of the reply to an EHLO command.

Some servers change their limits as a session goes on, based on getting more information. This extension doesn't try to handle in-session limit changes πŸ™…β€β™€οΈ

3.5. Interaction with SMTP Minimums πŸ“

SMTP specifies minimum values for various server sizes, limits, and timeouts [RFC5321b], e.g., servers must accept a minimum of 100 RCPT TO commands [RFC5321c]). Unfortunately, servers routinely impose smaller limits than SMTP requires, and when that happens it's super important for clients to know it's going on 😬

For this reason, there's no requirement that the limits advertised by this extension comply with the minimums imposed by SMTP. Ngl, that's a lot of honesty 🫣

3.6. Multiple EHLO Commands πŸ”

These protocols require the EHLO command (LHLO in LMTP) to be reissued in certain situations, e.g., after successful authentication [AUTH] or after negotiating a security layer [STARTTLS] πŸ”

Servers MAY return updated limits any time the protocol requires clients to reissue the EHLO command. Fresh limits, who dis πŸ’–

Clients MUST discard any previous limits in favor of the ones provided by the most recent EHLO. This includes the case where the original EHLO provided a set of limits but the subsequent EHLO didn't. In that case, the client MUST act as if no limits were communicated at all 🫠

3.7. Syntax Errors in the LIMITS Parameter Value ❌

Syntax errors in the basic parameter syntax are best handled by ignoring the value in its entirety. In this case, clients SHOULD proceed as if the LIMITS extension had never been used πŸ™ƒ

Syntax or other errors in the value syntax of a specific limit, including unrecognized value keywords, are best handled by ignoring that limit. In this case, the client MUST proceed as if that limit had not been specified πŸ’€

A future specification might create multiple limits that are interrelated in some way. If that happens, that specification MUST specify how an error in the value syntax of one limit affects the other limits 🧩

3.8. Caching of Limit Settings between Sessions Involving the Same Client and Server SMTP πŸ—ƒοΈ

Clients MAY cache limits determined during one session and use them to optimize their behavior for later sessions. However, servers are free to adjust their limits at any time, so clients MUST be able to accommodate any limit changes that happen between sessions. Always expect plot twists 🎭

4. Initial Limits πŸ’Ž

An initial set of limits is specified in the following sections πŸ“‹

4.1. MAILMAX Limit πŸ’Œ

  • Name: MAILMAX
  • Value syntax: %x31-39 0*5DIGIT ; "0" not allowed, six-digit maximum
  • Description: MAILMAX specifies the maximum number of transactions (MAIL FROM commands) the server will accept in a single session. The count includes all MAIL FROM commands, whether they succeed or fail. Every attempt counts, bestie πŸ“¬
  • Restrictions: None. Free and easy πŸ¦‹
  • Security Considerations: See Section 6 πŸ”’

4.2. RCPTMAX Limit πŸ’œ

  • Name: RCPTMAX
  • Value syntax: %x31-39 0*5DIGIT ; "0" not allowed, six-digit maximum
  • Description: RCPTMAX specifies the maximum number of RCPT TO commands the server will accept in a single transaction. It is not a limit on how many recipients the message actually ends up being sent to. A single RCPT TO command may produce multiple recipients or, if there's an error, none at all 🎯
  • Restrictions: None. No cap, no restrictions πŸ’…
  • Security Considerations: See Section 6 πŸ”

4.3. RCPTDOMAINMAX Limit ✨

okay so this one is giving domain drama 🌸 RCPTDOMAINMAX caps how many different domains can show up in the RCPT TO addresses in one session. Some servers hook into a specific internal delivery mechanism the moment they see the first RCPT TO, so they need to know the domain count up front 🧚

  • Name: RCPTDOMAINMAX
  • Value syntax:
%x31-39 0*5DIGIT ; "0" not allowed, six-digit maximum
  • Description: it's the max number of different domains allowed in RCPT TO addresses within a single session πŸ’…
  • Restrictions: none, bestie 🫢
  • Security Considerations: see Section 6 πŸ”’

5. Example

the server is showing off two limits it supports, alongside its other extensions, in this little chat πŸŽ€ the client sends EHLO, the server replies with its features, and then the vibes are set πŸ¦‹

S: [wait for open connection]
C: [open connection to server]
S: 220 mail.example.com ESMTP service ready
C: EHLO example.org
S: 250-mail.example.com
S: 250-SMTPUTF8
S: 250-LIMITS RCPTMAX=20 MAILMAX=5
S: 250-SIZE 100000000
S: 250-8BITMIME
S: 250-ENHANCEDSTATUSCODES
S: 250-PIPELINING
S: 250-CHUNKING
S: 250 STARTTLS

so now the client knows it can have up to twenty recipients in one transaction and up to five transactions in one session πŸ’– main character client energy πŸ‘‘


6. Security Considerations

⚠️ this section is serious, so read it carefully, bestie 😭

A malicious server can use limits to overly constrain client behavior, causing excessive use of client resources.

yep, a shady server could set limits so tight that the client wastes its own resources trying to work around them πŸ’€

A malicious client may use the limits a server advertises to optimize the delivery of unwanted messages. so spammers can read the limits and tune their sending to fit, ick πŸ™ˆ

A man-in-the-middle attack on unprotected SMTP connections can be used to cause clients to misbehave, which in turn could result in delivery delays or failures. Loss of reputation for the client could also occur. so an attacker sitting in the middle of an unencrypted connection can mess with the client, and the client's reputation can take the hit too 😭

All that said, decades of operational experience with the SMTP "SIZE" extension [SIZE], which provides servers with the ability to indicate message size, indicates that such abuse is rare and unlikely to be a significant problem. ngl, the SIZE extension has been around forever and this kind of abuse hasn't been a big deal, so we're not panicking 🌈

Use of the LIMITS extension to provide client-specific information - as opposed to general server limits - unavoidably provides senders with feedback about their reputation. Malicious senders can exploit this in various ways, e.g., start by sending good email and then, once their reputation is established, sending bad email. this is the part to watch: if the limits are tailored to each client, the sender gets a peek at their own reputation, and a bad actor can build trust first and then go rogue πŸ¦Ήβ€β™€οΈ


7. IANA Considerations

7.1. SMTP Service Extension Registry

IANA added LIMITS to the "SMTP Service Extensions" registry, and it looks like this πŸ¦‹

EHLO Keyword:  LIMITS
Description:  Server limits
Reference:  RFC 9422
Note:  See "SMTP Server Limits" registry.

7.2. SMTP Server Limits Registry

okay so IANA made a brand new registry in the "MAIL Parameters" group just for SMTP server limits πŸ“‹ the policy is "Specification Required", which means someone has to write a spec before anything gets in πŸ’… each entry has these required values:

  1. The name of the limit.
  2. The syntax of the limit value, if the limit has one. This syntax MUST conform to the provisions of Section 3 above. In most cases, the syntax will be a keyword naming the limit type followed by a limit value, in a name=value form like the ones this spec registers in Section 4 above. ABNF [ABNF] is preferred but not required πŸ“ if there's no limit value, that should be spelled out in the registration request and in the registry.
  3. A description of the limit's semantics. ✨ what does it actually mean?
  4. Restrictions, if any, on the use of the limit. If the limit is specific to any of SMTP, message submission, or LMTP, it should be documented here πŸŽ€
  5. Security considerations for the limit πŸ”’

the Designated Expert(s) under "Specification Required" should check that registration requests line up with the requirements and intent of the SMTP extension mechanisms [SMTP], with Section 3 above, and with this spec overall, and give advice accordingly 🧚

IANA has registered the limits from Section 4 of this document 🌸


8. References

okay the reference list is where everything is cited πŸ“š I've kept every entry exactly as written so nothing gets lost in translation 🫢

8.1. Normative References

[ABNF]     Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax
           Specifications: ABNF", STD 68, RFC 5234,
           DOI 10.17487/RFC5234, January 2008,
           <https://www.rfc-editor.org/info/rfc5234>.

[PIPELINING]
           Freed, N., "SMTP Service Extension for Command
           Pipelining", STD 60, RFC 2920, DOI 10.17487/RFC2920,
           September 2000, <https://www.rfc-editor.org/info/rfc2920>.

[RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
           Requirement Levels", BCP 14, RFC 2119,
           DOI 10.17487/RFC2119, March 1997,
           <https://www.rfc-editor.org/info/rfc2119>.

[RFC5321a] Klensin, J., "Simple Mail Transfer Protocol", Section 2.2,
           RFC 5321, October 2008,
           <https://www.rfc-editor.org/rfc/rfc5321>.

[RFC8174]  Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC
           2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174,
           May 2017, <https://www.rfc-editor.org/info/rfc8174>.

[SMTP]     Klensin, J., "Simple Mail Transfer Protocol", RFC 5321,
           DOI 10.17487/RFC5321, October 2008,
           <https://www.rfc-editor.org/info/rfc5321>.

8.2. Informative References

[AUTH]     Siemborski, R., Ed. and A. Melnikov, Ed., "SMTP Service
           Extension for Authentication", RFC 4954,
           DOI 10.17487/RFC4954, July 2007,
           <https://www.rfc-editor.org/info/rfc4954>.

[LMTP]     Myers, J., "Local Mail Transfer Protocol", RFC 2033,
           DOI 10.17487/RFC2033, October 1996,
           <https://www.rfc-editor.org/info/rfc2033>.

[RFC5321b] Klensin, J., "Simple Mail Transfer Protocol",
           Section 4.5.3.1, RFC 5321, October 2008,
           <https://www.rfc-editor.org/rfc/rfc5321>.

[RFC5321c] Klensin, J., "Simple Mail Transfer Protocol",
           Section 4.5.3.1.8, RFC 5321, October 2008,
           <https://www.rfc-editor.org/rfc/rfc5321>.

[SIZE]     Klensin, J., Freed, N., and K. Moore, "SMTP Service
           Extension for Message Size Declaration", STD 10, RFC 1870,
           DOI 10.17487/RFC1870, November 1995,
           <https://www.rfc-editor.org/info/rfc1870>.

[STARTTLS] Hoffman, P., "SMTP Service Extension for Secure SMTP over
           Transport Layer Security", RFC 3207, DOI 10.17487/RFC3207,
           February 2002, <https://www.rfc-editor.org/info/rfc3207>.

[SUBMIT]   Gellens, R. and J. Klensin, "Message Submission for Mail",
           STD 72, RFC 6409, DOI 10.17487/RFC6409, November 2011,
           <https://www.rfc-editor.org/info/rfc6409>.

Acknowledgments

this part is super sweet πŸ₯Ή it's all about the people who made this happen, including Ned Freed, who wrote most of this spec and sadly passed away in May 2022 before he could finish it πŸ•ŠοΈ John Klensin picked it up with support from the community and got it to a finished state 🌷 the team kept this as Ned's document, so some extra feature ideas were saved for future work instead of guessing what Ned would've wanted πŸ’œ

Acknowledgments from the Last Version Prepared by Ned Freed

A lot of people have helped make this specification possible. The author wishes to thank Claus Assmann, Laura Atkins, Alex Brotman, Richard Clayton, Dave Crocker, Viktor Dukhovni, Arnt Gulbrandsen, Jeremy Harris, Todd Herr, Mike Hillyer, Matthias Leisi, John Klensin, Valdis KlΔ“tnieks, John Levine, Alexey Melnikov, Keith Moore, Michael Peddemors, Hector Santos, George Schlossnagle, Rolf E. Sonneveld, and Alessandro Vesely for their contributions and reviews. 🫢

Acknowledgments from Versions Subsequent to Ned Freed's Passing

Additional helpful suggestions were received when the draft was requeued in the last part of 2022 and thereafter. Reviews and suggestions from Alex Brotman, Dave Crocker, Gene Hightower, Murray S. Kucherawy, Barry Leiba, John Levine, and Phil Pennock were especially helpful in identifying errors and suggesting clarifying some issues with the document without changing Ned's fundamental issues or very much of his text. πŸ“

IETF Last Call comments (and comments immediately before it started) from people not listed above that resulted in document changes were received from Amanda Baber (for IANA), Linda Dunbar, and Paul Kyzivat. 🌈


Authors' Addresses

Ned Freed


John C. Klensin
1770 Massachusetts Ave, Suite 322
Cambridge, MA 02140
United States of America
Email: john-ietf@jck.com
πŸ“¦ where this page comes from