RFC 2442

The Batch SMTP Media Type

๐Ÿ“… published November 1998, from ietf

The Batch SMTP Media Type โœจ

okay bestie, this is RFC 2442 ๐Ÿ“ฎ and it's all about how to wrap up an SMTP conversation inside a MIME package. Here's the title block tea โ˜•:

  • Network Working Group, RFC number 2442
  • Authors: N. Freed (Innosoft), D. Newman (Innosoft), J. Belissent (Sun Microsystems), M. Hoy (Mainbrace)
  • Category: Informational
  • Date: November 1998
  • Obsoletes / Updates: the title block doesn't list either one ๐Ÿ’…
it's Informational, so it's giving "here's some helpful info" and NOT an Internet standard. the status section spells it out ๐Ÿซถ

Status of this Memo

this memo gives info to the Internet community ๐ŸŒธ it does not specify an Internet standard of any kind, and distribution of it is unlimited.

Copyright (C) The Internet Society (1998). All Rights Reserved. ๐ŸŽ€

Abstract

okay so this doc defines a MIME content type that's perfect for tunneling an ESMTP [RFC-821, RFC-1869] transaction through any MIME-capable transport ๐Ÿฆ‹ and it's giving main character energy because it can be used for a few things:

  • extending end-to-end MIME-based security services (e.g., [RFC-1847]) so they cover the message envelope info as well as the message content ๐Ÿ”
  • making it possible to use specific SMTP extensions, like NOTARY [RFC-1891], over unextended SMTP transport infrastructure โœจ
  • enabling the transfer of multiple separate messages in a single transactional unit ๐Ÿ’œ

Requirements Notation

this doc sometimes uses words in capital letters ๐Ÿ‘€ when the terms "MUST", "MUST NOT", "SHOULD", "SHOULD NOT", and "MAY" show up capitalized, they're flagging particular requirements of this spec. the meanings of "MUST", "SHOULD", and "MAY" get discussed in [RFC-1123], and "MUST NOT" and "SHOULD NOT" are logical extensions of that same usage ๐Ÿง 

The Application/batch-SMTP Content Type

the "application/batch-SMTP" MIME content type is a container for the client side of an SMTP or ESMTP transaction ๐Ÿ“ฆ like traditional SMTP, the contents are line oriented, and CRLF line terminators MUST be used ๐Ÿ’–

the "application/batch-SMTP" type is defined like this:

Media type name: application
Media subtype name: batch-SMTP
Required parameters: none
Optional parameters: required-extensions
Encoding considerations:
  8bit material may appear, so quoted-printable or base64
  encoding may be necessary on transports that do not
  support 8bit. While the content of this type is
  line-oriented and uses conventional CR/LF terminators,
  lines longer than 7bit and 8bit encodings allow (998
  octets) may appear, hence quoted-printable or
  base64 encoding may be necessary even in conjunction
  with 8bit transports.
Security considerations:
  Discussed in the Security Considerations Section.

How application/batch-SMTP is used

here's the vibe check on how the type is meant to flow ๐ŸŒˆ

                    application/batch-SMTP object
                         +----------------+
                         |                |
           +-----------+ v  +----------+  v +-----------+
           | batch     |    | MIME-    |    | batch     |
        => | SMTP      | => | capable  | => | SMTP      | =>
           | generator |    |transport |    | processor |
        ^  +-----------+    +----------+    +-----------+  ^
        |                                                  |
        +-- conventional SMTP/RFC822 message transaction --+

so a regular SMTP message transaction gets turned into an application/batch-SMTP object by the batch SMTP generator ๐Ÿช„ then that object rides over some kind of MIME-capable transport. once it reaches the destination, a batch SMTP processor takes it and converts it back into a conventional SMTP message transaction ๐Ÿฆ‹

Generation of application/batch-SMTP material

application/batch-SMTP material is generated by a specially modified SMTP client that's operating without a matching SMTP server ๐Ÿซ  the client just assumes a successful response to every command it sends, and the result is the collected output from the SMTP client โœจ

Honoring SMTP restrictions

most batch SMTP processors will be built by modifying and extending existing SMTP servers ๐Ÿ› ๏ธ so all of the restrictions on SMTP constructs imposed by RFC 821, RFC 1123, and RFC 1869 MUST be observed ๐Ÿ’… especially the limits on command and data line lengths, the number of recipients, and so on. those still exist and still apply to batch SMTP, no cap ๐Ÿ™…โ€โ™€๏ธ

Use of SMTP Extensions

since there's no SMTP server present, the client has to be ready to make certain assumptions about which SMTP extensions can be used ๐Ÿงš the generator MAY assume that ESMTP [RFC-1869] facilities are available, so it's totally fine to use the EHLO command plus extra parameters on MAIL FROM and RCPT TO. if EHLO is used, it MAY assume that the 8bitMIME [RFC-1652], SIZE [RFC-1870], and NOTARY [RFC-1891] extensions are available. and yes, NOTARY SHOULD be used ๐Ÿ”ฅ

a generator MAY create private bilateral agreements that specify the availability of additional SMTP extensions ๐Ÿค but additional SMTP extensions MUST NOT be used without such an agreement. and perhaps more importantly, a conformant generation of application/batch-SMTP objects MUST be able to produce objects restricted to the extensions listed above ๐Ÿ’œ

the "required-extensions" content type parameter MAY be used to communicate a list of the extensions that were actually used, written as a comma-separated list of EHLO responses ๐Ÿ“ if it's absent, it defaults to the list "8bitMIME,SIZE,NOTARY". and any use of additional or different extensions by private bilateral agreement MUST be noted in the "required-extensions" parameter ๐ŸŽ€

reminder: lots of SMTP extensions just don't make sense for batch SMTP ๐Ÿ’€ for example, the pipelining extension [RFC-2197] makes no sense without a network connection.

Handling Multiple Messages

generators SHOULD attempt to minimize the number of messages placed in a single application/batch-SMTP object ๐Ÿ“ ideally there's one application/batch-SMTP object per message. BUT some uses (like mail bagging) may exist purely to take advantage of the multiple-messages-in-one-container capability of batch SMTP, so requiring one message per container just isn't possible ๐ŸŽ’

DISCUSSION: SMTP lets you transfer a series of messages over a single connection, and that extends naturally to batch SMTP ๐ŸŒธ the issues are a little different though. imagine a batch SMTP processor gets an application/batch-SMTP object with two messages, but it can't process the second one because of a storage allocation failure ๐Ÿ˜ญ and the failure doesn't just block the second message, it also blocks recording that the first message was already processed. then reprocessing the application/batch-SMTP could duplicate the first message. yikes ๐Ÿ™ˆ

this isn't materially different from the well-known SMTP synchronization problems that in practice often lead to duplicated messages. since that behavior is inherent in SMTP to begin with, it's not incumbent on application/batch-SMTP to fully solve it. still, it seems prudent for application/batch-SMTP to try not to make matters even worse ๐Ÿซถ

Transport of application/batch-SMTP objects

application/batch-SMTP objects may be carried by any transport that can preserve their MIME labelling, e.g., HTTP or SMTP ๐Ÿš€

transports MUST stay aware of how special application/batch-SMTP is ๐ŸŒŸ an application/batch-SMTP object contains one or more "frozen" SMTP message transactions. those transactions usually come with assumptions about quality of service, like: messages will either be delivered successfully or a nondelivery notification will come back, a nondelivery notification will come back if delivery can't happen in a timely fashion, and so on ๐Ÿฅบ it's vital that wrapping these objects for other kinds of transport doesn't interfere with those capabilities ๐Ÿ”’

Processing of application/batch-SMTP material

processing application/batch-SMTP material is WAY more complex than generating it ๐Ÿ˜ค as you'd expect, a modified SMTP/ESMTP processor gets used. but since it can't send information back to the client, it has to handle all of the error conditions that come up by itself. so a batch SMTP processor takes on the responsibilities of a traditional SMTP server AND part of the responsibilities of a traditional SMTP client ๐Ÿ‘‘

so a conforming processor has a checklist ๐Ÿ“‹

  • a conforming processor MUST check MIME content type information to insure that the material it's been given is labelled as application/batch-SMTP and doesn't specify any extensions the processor doesn't support in the "required-extensions" parameter ๐Ÿ”
  • application/batch-SMTP objects that use an unsupported extension SHOULD be forwarded to the local postmaster for manual inspection and handling ๐Ÿ“จ
  • MUST accept any syntactically valid EHLO or HELO command ๐Ÿ’ฌ
  • MUST accept any syntactically valid MAIL FROM command ๐Ÿ’Œ
  • a conforming processor MAY, if it so desires, note that some part of a given MAIL FROM command is unacceptable, and use that info to later generate non-delivery notifications for any or all recipients ๐Ÿ™…โ€โ™€๏ธ
  • MUST accept any syntactically valid RCPT TO command ๐Ÿ“ฌ
  • a conforming processor SHOULD note that some part of a given RCPT TO command is unacceptable, and then use that to generate a non-delivery notification for that recipient instead of actually delivering the message ๐Ÿซก
  • MUST accept any of the additional parameters defined by the 8bitMIME, SIZE, and NOTARY SMTP extensions on the MAIL FROM and RCPT TO commands โœจ
  • MUST accept the DATA command even when no valid recipients are present ๐Ÿ™
  • 8bit MIME messages MUST be accepted ๐ŸŒˆ
  • MUST accept the RSET command and handle multiple messages in a single application/batch-SMTP object ๐Ÿงบ
  • processors MUST process each message in an application/batch-SMTP object once, and SHOULD take whatever steps are necessary to avoid processing a message more than once ๐Ÿ” for example, if processing of an application/batch-SMTP object containing multiple messages gets interrupted at an intermediate point, it should subsequently be restarted at the end of the last message that was completely processed ๐Ÿชง
  • SHOULD forward any syntactically invalid application/batch-SMTP message to the local postmaster for manual inspection and handling ๐Ÿง

Security Considerations ๐Ÿ”’

Okay bestie, this section is SERIOUS ๐Ÿ˜ญ. Application/batch-SMTP is a tunneling mechanism, and tunneling mechanisms are prone to abuse because they can give someone a way to sneak past existing security restrictions. For example, an application/batch-SMTP tunnel running over an existing SMTP transport might let someone get around the relay restrictions that exist to stop spam from being redistributed. Not cute. ๐Ÿ’€

Tunnels are sneaky little things, so the people running them need to be careful about who gets to use them. ๐Ÿ•ต๏ธโ€โ™€๏ธ

Application/batch-SMTP processors SHOULD implement access restrictions designed to limit access to the processor to authorized generators only. (Note that this facility may be provided automatically if application/batch-SMTP is being used to secure message envelope information.) ๐Ÿซถ

Acknowledgements ๐ŸŽ€

Okay so the general concept of batch SMTP has been around for ages ๐Ÿฆ‹. One particular type was defined by Alan Crosswell and used on BITNET to get around BITNET's native 8 character limit on user and host names. The catch is that this version had the server send the status code responses back to the client, which meant the client had to match up those responses with the original SMTP dialogue after the fact. That was a lot of work for the client. ๐Ÿ˜ฉ

Unfortunately, this approach didn't work well in practice. BITNET eventually switched to the same basic form of batch SMTP that's defined here. The thing is, to the best of the present authors' knowledge, that definition was never written down in a formal specification. Also, this definition is different in that it takes SMTP extensions into account. โœจ

Einar Stefferud had already been thinking about the problem of carrying extended SMTP messages over unextended SMTP transports. He proposed that some form of "double enveloping" technology be developed to solve it. The mechanism presented here basically implements the kind of solution he proposed. Iconic behaviour from a legend ๐Ÿ‘‘.

References ๐Ÿ“š

[RFC-821] Postel, J., "Simple Mail Transfer Protocol", STD 10, RFC 821, August 1982. ๐Ÿ’Œ

[RFC-822] Crocker, D., "Standard for the Format of ARPA Internet Text Messages", STD 11, RFC 822 August 1982. ๐Ÿ’Œ

[RFC-1123] Braden, B., "Requirements for Internet Hosts -- Application and Support", STD 3, RFC 1123, October 1989. ๐ŸŒธ

[RFC-1652] Klensin, J., Freed, N., Rose, M., Stefferud, E. and D. Crocker, "SMTP Service Extension for 8bit-MIMEtransport", RFC 1652, July 1994. ๐ŸŒˆ

[RFC-1847] Galvin, J., Murphy, S., Crocker, S. and N. Freed, "Security Multiparts for MIME: Multipart/Signed and Multipart/Encrypted", RFC 1847, October 1995. ๐Ÿ”

[RFC-1869] Klensin, J., Freed, N., Rose, M., Stefferud, E. and D. Crocker, "SMTP Service Extensions", STD 10, RFC 1869, November 1995. ๐Ÿฆ‹

[RFC-1870] Klensin, J., Freed, N., Moore, K., "SMTP Service Extension for Message Size Declaration", STD 10, RFC 1870, November, 1995. ๐Ÿ“

[RFC-2045] Freed, N. and N. Borenstein, "Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies", RFC 2045, December 1996. ๐Ÿงฉ

[RFC-2046] Freed, N. and N. Borenstein, "Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types", RFC 2046, December 1996. ๐Ÿงฉ

[RFC-2197] Freed, N. and A. Cargille, "SMTP Service Extension for Command Pipelining", RFC 2197, September 1997. โšก

Authors' Addresses ๐Ÿ’–

Ned Freed
Innosoft International, Inc.
1050 Lakes Drive
West Covina, CA 91790
USA

Phone: +1 626 919 3600
Fax:   +1 626 919 3614
EMail: ned.freed@innosoft.com


Dan Newman
Innosoft International, Inc.
1050 Lakes Drive
West Covina, CA 91790
USA

Phone: +1 626 919 3600
Fax:   +1 626 919 3614
EMail: dan.newman@innosoft.com

Mark Hoy
Mainbrace Corporation
1136 West Evelyn Avenue
Sunnyvale, CA 94086

tel: +1 408 774 5265
fax: +1 408 774 5290
email: mark.hoy@mainbrace.com


Jacques Bellisent
SunSoft

Phone: +1 650 786 3630
EMail: jacques.belissent@eng.sun.com

Copyright (C) The Internet Society (1998). All Rights Reserved.

This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this paragraph are included on all such copies and derivative works. However, this document itself may not be modified in any way, such as by removing the copyright notice or references to the Internet Society or other Internet organizations, except as needed for the purpose of developing Internet standards in which case the procedures for copyrights defined in the Internet Standards process must be followed, or as required to translate it into languages other than English.

The limited permissions granted above are perpetual and will not be revoked by the Internet Society or its successors or assigns.

This document and the information contained herein is provided on an "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. ๐ŸŒŸ

๐Ÿ“ฆ where this page comes from