RFC 2033
Local Mail Transfer Protocol
RFC 2033: Local Mail Transfer Protocol πβ¨
Okay bestie, this one is by J. Myers from Carnegie Mellon π. It's marked as Informational π, and it's dated October 1996 π. The header doesn't say it obsoletes or updates anything, so there's no drama there π«Ά.
Status of this Memo π
This memo gives information to the Internet community π. It does not specify an Internet standard of any kind. Distribution of this memo is unlimited π.
1. Abstract π¦
Okay so SMTP [SMTP] [HOST-REQ] and its service extensions [ESMTP] are literally the queen of moving mail reliably and efficiently π. The way SMTP is designed, the server basically has to run a mail delivery queue π¬.
But there are some limited situations, way outside the world of mail trading between independent hosts on public networks, where you want a mail receiver that doesn't manage a queue π§. This document explains LMTP, which is the protocol for transporting mail into those kinds of systems π .
LMTP is an alternative to ESMTP, but it uses the syntax and semantics of ESMTP (with a few changes). So LMTP can use the ESMTP extensions too, which is so iconic π. LMTP should be used only with specific prior arrangement and configuration, and it MUST NOT be used on TCP port 25 π.
Table of Contents
1. Abstract ................................................ 1
2. Conventions Used in this Document ....................... 2
3. Introduction and Overview ............................... 2
4. The LMTP protocol ....................................... 3
4.1. The LHLO, HELO and EHLO commands ........................ 4
4.2. The DATA command ........................................ 4
4.3. The BDAT command ........................................ 5
5. Implementation requirements ............................. 6
6. Acknowledgments ......................................... 6
7. References .............................................. 7
8. Security Considerations ................................. 7
9. Author's Address ........................................ 7
2. Conventions Used in this Document π
In the examples, C: means lines sent by the client, and S: means lines sent by the server π¬.
3. Introduction and Overview πΈ
Okay, so the SMTP design basically forces the server to manage a mail delivery queue π¬. That's because one mail transaction can name multiple recipients, but the final . of the DATA command can only return one reply code to say how the whole transaction went π.
Let's say a server gets a transaction for two recipients. Delivery to the first one works, but delivery to the second hits a temporary failure. There's no way to tell the client about that situation π. So the server has to queue the message and try again later for the second recipient π.
Honestly, that queuing is a huge win for what SMTP was originally built for: store-and-forward relaying of mail between networked hosts π«Ά. But in some limited situations, you'd rather have a server that doesn't manage a queue, and instead let the client handle queue management β¨. Here's a hypothetical host with a mail system set up like this:
TCP port 25 +-----------------+
---------------------->| | #########
| Queue |<># Mail #
TCP port 25 | Manager | # Queue #
<----------------------| | #########
+-----------------+
Local * ^ Local * Local
IPC * | IPC * IPC
* | *
* | *
* | *
V | V
Non-SMTP +----------+ +----------+
Protocol | Gateway | | Local | #########
<==============>| Delivery | | Delivery |>># Mail #
| Agent | | Agent | # Spool #
+----------+ +----------+ #########
This host's mail system has three separate subsystems that talk to each other π§©. The first is the queue manager. It acts like a classic SMTP agent, moving messages to and from other hosts over TCP, and it manages a mail queue in persistent storage π¦. The other two are agents that handle delivery for addresses in the domains this host is responsible for π. One of them does gatewaying to and from some other mail system π. The other one delivers the message into a persistent mail spool ποΈ.
It would be nice to use SMTP over a local inter-process communication channel to move messages from the queue manager to the delivery agents π. But making the delivery agents manage their own mail queues would make them way more complicated π΅βπ«.
Then there's the common approach: you call a delivery agent with the envelope address(es) as command-line arguments, and the agent reports status with an exit code. That approach has three serious problems π¨. First, the agent can only return one exit code, and it gets applied to all recipients π€. Second, it's hard to extend the interface to handle ESMTP extensions like DSN [DSN] and ENHANCEDSTATUSCODES [ENHANCEDSTATUSCODES] π. Third, exits caused by system libraries because of temporary conditions often get read as permanent errors π.
LMTP fixes this. After the final . of the DATA command, the server sends back one reply for each recipient π. So if the queue manager uses LMTP instead of SMTP when it hands messages to the delivery agents, the agents can try delivery to each recipient after the final . and report each recipient's status individually β¨. The connections that should use LMTP are marked with asterisks in the diagram above β.
Also, it's not beneficial to use LMTP when transferring messages to the queue manager, whether they come from the network or from a delivery agent π ββοΈ. The queue manager already implements a mail queue, so it can store the message and take responsibility for delivering it later π¬π«Ά.
4. The LMTP protocol π
The LMTP protocol is identical to SMTP [SMTP] [HOST-REQ] with its service extensions [ESMTP], except where this document modifies it π.
A "successful" RCPT command is one that returns a Positive Completion reply code π₯³.
A "Positive Completion reply code" is defined in Appendix E of STD 10, RFC 821 [SMTP] as a reply code whose first digit is "2" π’.
4.1. The LHLO, HELO and EHLO commands π
The LHLO command replaces the HELO and EHLO commands of ESMTP π. This lets you catch a misconfiguration where the two parties aren't using the same protocol π΅οΈββοΈ.
The LHLO command has identical semantics to the EHLO command of ESMTP [ESMTP] π€.
The HELO and EHLO commands of ESMTP are not present in LMTP. An LMTP server MUST NOT return a Positive Completion reply code to these commands π«. The 500 reply code is recommended π
.
4.2. The DATA command π¨
LMTP puts one extra restriction on the DATA command, and it changes how replies to the final . are sent π.
The extra restriction is this: if there have been no successful RCPT commands in the mail transaction, the DATA command MUST fail with a 503 reply code π ββοΈ.
The change is that after the final ., the server returns one reply for each previously successful RCPT command in the mail transaction, in the same order the RCPT commands were issued π. Even if several successful RCPT commands gave the same forward-path, there must be one reply for each successful RCPT command π«Ά.
When one of these replies to the final . is a Positive Completion reply, the server is accepting responsibility for delivering or relaying the message to that recipient π€. It has to take that responsibility seriously. So it MUST NOT lose the message for frivolous reasons, like the host crashing later or a predictable resource shortage π€π₯.
A multiline reply still counts as a single reply, and it corresponds to a single RCPT command π.
EXAMPLE:
S: 220 foo.edu LMTP server ready
C: LHLO foo.edu
S: 250-foo.edu
S: 250-PIPELINING
S: 250 SIZE
C: MAIL FROM:<chris@bar.com>
S: 250 OK
C: RCPT TO:<pat@foo.edu>
S: 250 OK
C: RCPT TO:<jones@foo.edu>
S: 550 No such user here
C: RCPT TO:<green@foo.edu>
S: 250 OK
C: DATA
S: 354 Start mail input; end with <CRLF>.<CRLF>
C: Blah blah blah...
C: ...etc. etc. etc.
C: .
S: 250 OK
S: 452 <green@foo.edu> is temporarily over quota
C: QUIT
S: 221 foo.edu closing connection
NOTE: in the example above, the domain names of the client and server are identical. That's because in the example, the client and server are different subsystems of the same mail domain π§ .
4.3. The BDAT command π§
If the server supports the ESMTP CHUNKING extension [BINARYMIME], a BDAT command containing the LAST parameter returns one reply for each previously successful RCPT command in the mail transaction, in the same order the RCPT commands were issued π. Even if several successful RCPT commands gave the same forward-path, there must be one reply for each successful RCPT command π. If there were no previously successful RCPT commands in the mail transaction, then the BDAT LAST command returns zero replies 0οΈβ£.
When one of these replies to the BDAT LAST command is a Positive Completion reply, the server is accepting responsibility for delivering or relaying the message to that recipient π«Ά. It must take this responsibility seriously. So it MUST NOT lose the message for frivolous reasons, like the host crashing later or a predictable resource shortage π.
A multiline reply still counts as a single reply, and it corresponds to a single RCPT command π.
The behavior of BDAT commands without the LAST parameter is not changed. They still return exactly one reply π¦.
5. Implementation requirements π β¨
okay bestie, so LMTP is a different protocol from SMTP, which means it MUST NOT be used on TCP service port 25. no cap, port 25 is SMTP's spot and we don't crash the party π ββοΈπ
A server implementation MUST implement the PIPELINING [PIPELINING] and ENHANCEDSTATUSCODES [ENHANCEDSTATUSCODES] ESMTP extensions. A server implementation SHOULD implement the 8BITMIME [8BITMIME] extension. these are the core vibes πΈ
okay now the drama π using LMTP can make the situation in [DUP-MSGS] worse. to dodge this synchronization problem, implementations have to follow these rules:
A server implementation which is capable of quickly accepting responsibility for delivering or relaying a message to multiple recipients and which is capable of sending any necessary notification messages SHOULD NOT implement the LMTP protocol. π
The LMTP protocol SHOULD NOT be used over wide area networks. π
The server SHOULD send each reply as soon as possible. If it is going to spend a nontrivial amount of time handling delivery for the next recipient, it SHOULD flush any outgoing LMTP buffer, so the reply may be quickly received by the client. β‘
The client SHOULD process the replies as they come in, instead of waiting for all of the replies to arrive before processing any of them. If the connection closes after replies for some, but not all, recipients have arrived, the client MUST process the replies that arrived and treat the rest as temporary failures. literally the most important part of this whole section π«Ά
6. Acknowledgments π
ok so this work is a refinement of the MULT extension, which was invented by Jeff Michaud and was used in implementing gateways to the Mail-11 mail system. huge shoutout to Jeff π
Many thanks to Matt Thomas for helping the author understand the semantics of the Mail-11 MULT extension. he's the real MVP π§
7. References π
[8BITMIME] Klensin, J., et. al, "SMTP Service Extension for 8bit-MIME transport", RFC 1652, July 1994.
[BINARYMIME] Vaudreuil, G., "SMTP Service Extensions for Transmission of Large and Binary MIME Messages", RFC 1830, August 1995.
[DSN] Moore, K., Vaudreuil, G., "An Extensible Message Format for Delivery Status Notifications", RFC 1894, January 1996.
[DUP-MSGS] Partridge, C., "Duplicate messages and SMTP", RFC 1047, February 1988.
[ENHANCEDSTATUSCODES] Freed, N., "SMTP Service Extension for Returning Enhanced Error Codes", RFC 2034, October 1996.
[ESMTP] Rose, M., Stefferud, E., Crocker, C., Klensin, J., Freed, N., "SMTP Service Extensions", RFC 1869, November 1995.
[HOST-REQ] Braden, R., "Requirements for Internet hosts - application and support", STD 3, RFC 1123 section 5, October 1989.
[PIPELINING] Freed, N., Cargille, A, "SMTP Service Extension for Command Pipelining", RFC 1854, October 1995.
[SMTP] Postel, J., "Simple Mail Transfer Protocol", STD 10, RFC 821, August 1982.
There are no known security issues with the issues in this memo.
9. Author's Address π¦
John G. Myers Carnegie-Mellon University 5000 Forbes Ave. Pittsburgh PA, 15213-3890
EMail: jgm+@cmu.edu
π¦ where this page comes from
- ietf: rfc2033 1996-10
- π girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms