1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
|
Network Working Group J. Myers
Request for Comments: 2033 Carnegie Mellon
Category: Informational October 1996
Local Mail Transfer Protocol
Status of this Memo
This memo provides information for the Internet community. This memo
does not specify an Internet standard of any kind. Distribution of
this memo is unlimited.
1. Abstract
SMTP [SMTP] [HOST-REQ] and its service extensions [ESMTP] provide a
mechanism for transferring mail reliably and efficiently. The design
of the SMTP protocol effectively requires the server to manage a mail
delivery queue.
In some limited circumstances, outside the area of mail exchange
between independent hosts on public networks, it is desirable to
implement a system where a mail receiver does not manage a queue.
This document describes the LMTP protocol for transporting mail into
such systems.
Although LMTP is an alternative protocol to ESMTP, it uses (with a
few changes) the syntax and semantics of ESMTP. This design permits
LMTP to utilize the extensions defined for ESMTP. LMTP should be
used only by 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
Myers Informational [Page 1]
^L
RFC 2033 LMTP October 1996
2. Conventions Used in this Document
In examples, "C:" and "S:" indicate lines sent by the client and
server respectively.
3. Introduction and Overview
The design of the SMTP protocol effectively requires the server to
manage a mail delivery queue. This is because a single mail
transaction may specify multiple recipients and the final "." of the
DATA command may return only one reply code, to indicate the status
of the entire transaction. If, for example, a server is given a
transaction for two recipients, delivery to the first succeeds, and
delivery to the second encounters a temporary failure condition,
there is no mechanism to inform the client of the situation. The
server must queue the message and later attempt to deliver it to the
second recipient.
This queuing requirement is beneficial in the situation for which
SMTP was originally designed: store-and-forward relay of mail between
networked hosts. In some limited situations, it is desirable to have
a server which does not manage a queue, instead relying on the client
to perform queue management. As an example, consider a hypothetical
host with a mail system designed as follows:
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 #
+----------+ +----------+ #########
The host's mail system has three independent, communicating
subsystems. The first is a queue manager, which acts as a
Myers Informational [Page 2]
^L
RFC 2033 LMTP October 1996
traditional SMTP agent, transferring messages to and from other hosts
over TCP and managing a mail queue in persistent storage. The other
two are agents which handle delivery for addresses in domains for
which the host takes responsibility. One agent performs gatewaying
to and from some other mail system. The other agent delivers the
message into a persistent mail spool.
It would be desirable to use SMTP over a local inter-process
communication channel to transfer messages from the queue manager to
the delivery agents. It would, however, significantly increase the
complexity of the delivery agents to require them to manage their own
mail queues.
The common practice of invoking a delivery agent with the envelope
address(es) as command-line arguments, then having the delivery agent
communicate status with an exit code has three serious problems: the
agent can only return one exit code to be applied to all recipients,
it is difficult to extend the interface to deal with ESMTP extensions
such as DSN [DSN] and ENHANCEDSTATUSCODES [ENHANCEDSTATUSCODES], and
exits performed by system libraries due to temporary conditions
frequently get interpreted as permanent errors.
The LMTP protocol causes the server to return, after the final "." of
the DATA command, one reply for each recipient. Therefore, if the
queue manager is configured to use LMTP instead of SMTP when
transferring messages to the delivery agents, then the delivery
agents may attempt delivery to each recipient after the final "." and
individually report the status for each recipient. Connections which
should use the LMTP protocol are drawn in the diagram above using
asterisks.
Note that it is not beneficial to use the LMTP protocol when
transferring messages to the queue manager, either from the network
or from a delivery agent. The queue manager does implement a mail
queue, so it may store the message and take responsibility for later
delivering it.
4. The LMTP protocol
The LMTP protocol is identical to the SMTP protocol SMTP [SMTP]
[HOST-REQ] with its service extensions [ESMTP], except as modified by
this document.
A "successful" RCPT command is defined as an RCPT command which
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 which "2" as the first digit.
Myers Informational [Page 3]
^L
RFC 2033 LMTP October 1996
4.1. The LHLO, HELO and EHLO commands
The HELO and EHLO commands of ESMTP are replaced by the LHLO command.
This permits a misconfiguration where both parties are not using the
same protocol to be detected.
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. A LMTP
server MUST NOT return a Postive Completion reply code to these
commands. The 500 reply code is recommended.
4.2. The DATA command
In the LMTP protocol, there is one additional restriction placed on
the DATA command, and one change to how replies to the final "." are
sent.
The additional restriction is that when 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 order that the RCPT commands were issued. Even if there were
multiple successful RCPT commands giving 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
relying the message to the corresponding recipient. It must take
this responsibility seriously, i.e., it MUST NOT lose the message for
frivolous reasons, e.g., because the host later crashes or because of
a predictable resource shortage.
A multiline reply is still considered a single reply and 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
Myers Informational [Page 4]
^L
RFC 2033 LMTP October 1996
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 above example, the domain names of both the client and
server are identical. This is 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
order that the RCPT commands were issued. Even if there were
multiple successful RCPT commands giving 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.
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 the corresponding recipient.
It must take this responsibility seriously, i.e., it MUST NOT lose
the message for frivolous reasons, e.g., because the host later
crashes or because of a predictable resource shortage.
A multiline reply is still considered a single reply and corresponds
to a single RCPT command.
The behavior of BDAT commands without the LAST parameter is not
changed; they still return exactly one reply.
Myers Informational [Page 5]
^L
RFC 2033 LMTP October 1996
5. Implementation requirements
As LMTP is a different protocol than SMTP, it MUST NOT be used on the
TCP service port 25.
A server implementation MUST implement the PIPELINING [PIPELINING]
and ENHANCEDSTATUSCODES [ENHANCEDSTATUSCODES] ESMTP extensions. A
server implementation SHOULD implement the 8BITMIME [8BITMIME]
extension.
Use of LMTP can aggravate the situation described in [DUP-MSGS]. To
avoid this synchronization problem, the following requirements are
made of implementations:
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.
6. Acknowledgments
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.
Many thanks to Matt Thomas for assisting me in understanding the
semantics of the Mail-11 MULT extension.
Myers Informational [Page 6]
^L
RFC 2033 LMTP October 1996
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
Myers Informational [Page 7]
^L
|