[From: http://jabr.ne.mediaone.net/documents/xmtp.htm, 2000-05-07; use this canonical URL/version if possible.]
Copyright (c) 1998-2000 Jonathan Borden ALL RIGHTS RESERVED
Contact: Jonathan Borden
XMTP is part of the GroveLogic (tm) package.
The eXtensible Mail Transport Protocol (XMTP) is a mapping of MIME/SMTP to XML. MIME is the lingua franca of the Web. Both the HTTP and SMTP protocols are MIME based. As XML gains in popularity it is useful to be able to represent MIME messages as XML documents. This mapping is straightforward and demonstrates handling of binary data in XML documents as base64 encodings.
Using XMTP, SMTP messages can be transformed via XSLT into HTML pages for viewing. XMTP has been implemented in Java using SAX and in C++/COM using the IE5 DOM.
The first standards for the transmission of text messages over the Internet (then the Arpanet) were defined by RFC 821/822. Multimedia Internet Message Extensions (MIME) extended this format for the representation of multimedia types. The basic organization of a MIME message is:
Headers
<CR><LF>
<CR><LF>
Body
MIME messages are used in both the SMTP and HTTP protocols and hence are the essential basic datatype of the Internet.
Mapping the MIME format into XML allows the integration of MIME messages into XML systems. This mapping is straightforward:
Received: from jabr (jabr.ne.mediaone.net [24.128.34.211])
by chmls05.mediaone.net (8.8.7/8.8.7) with SMTP id XAA27071
for <test-xmtp@jabr.ne.mediaone.net>; Tue, 13 Oct 1998 23:42:47 -0400
(EDT)
From: "Borden, Jonathan" <jborden@mediaone.net>
To: "XMTP" <test-xmtp@jabr.ne.mediaone.net>
Subject: this is a simple message
Date: Tue, 13 Oct 1998 23:33:49 -0400
Message-ID: <001501bdf723$74f03fe0$d3228018@jabr.ne.mediaone.net>
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_NextPart_000_0016_01BDF701.EDDE9FE0"
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Importance: Normal
This is a multi-part message in MIME format.
------=_NextPart_000_0016_01BDF701.EDDE9FE0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Here is the text of the message ... its being transmitted in 'HTML' format
but the text is a separate part for e-mail readers that don't understand
HTML. We can't assume that all valid HTML is XML so we have to escape all of
the HTML ... or use a CDATA section
jon
------=_NextPart_000_0016_01BDF701.EDDE9FE0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D'"MSHTML 4.72.3110.7"' name=3DGENERATOR>
</HEAD>
<BODY bgColor=3D#ffffff>
<P><FONT size=3D2>Here is the text of the <STRONG><FONT
color=3D#0000ff =
face=3D""=20
size=3D5>message</FONT></STRONG> ... its being transmitted in
'HTML' =
format but=20
the text is a separate part for e-mail readers that don't understand =
HTML. We=20
can't assume that all valid HTML is XML so we have to <FONT =
color=3D#ff0000=20
face=3D"" size=3D5>escape </FONT>all of the HTML ... .or
use a CDATA=20
section<BR><BR>jon<BR></FONT></P></BODY></HTML>
------=_NextPart_000_0016_01BDF701.EDDE9FE0--
<MIME xmlns:mime="http://www.grovelogic.com/xmtp"
xmlns="http://www.grovelogic.com/xmtp">
<Content-Type boundary="----=_NextPart_000_0016_01BDF701.EDDE9FE0">multipart/alternative</Content-Type>
<Content-transfer-encoding>binary</Content-transfer-encoding>
<Date>Tue, 13 Oct 1998 23:33:49 -0400</Date>
<From>"Borden, Jonathan"
<jborden@mediaone.net></From>
<Importance>Normal</Importance>
<Message-ID><001501bdf723$74f03fe0$d3228018@jabr.ne.mediaone.net></Message-ID>
<MIME-Version>1.0</MIME-Version>
<Received>from jabr (jabr.ne.mediaone.net
[24.128.34.211])
by chmls05.mediaone.net (8.8.7/8.8.7) with SMTP id XAA27071
for <test-xmtp@jabr.ne.mediaone.net>; Tue, 13 Oct 1998 23:42:47
-0400 (EDT)</Received>
<Subject>this is a simple message</Subject>
<To>"XMTP" <test-xmtp@jabr.ne.mediaone.net></To>
<X-Mailer>Microsoft Outlook 8.5, Build
4.71.2173.0</X-Mailer>
<X-MimeOLE>Produced By Microsoft MimeOLE
V4.72.3110.3</X-MimeOLE>
<X-MSMail-Priority>Normal</X-MSMail-Priority>
<X-Priority>3 (Normal)</X-Priority>
<mime:BODY>
<Parts>
<MIME xmlns:mime="http://www.grovelogic.com/xmtp"
xmlns="urn:xpository:xmtp">
<Content-Type charset="iso-8859-1">text/plain</Content-Type>
<Content-transfer-encoding>7bit</Content-transfer-encoding>
<mime:BODY xmlns=""><![CDATA[
Here is the text of the message ... its being transmitted in 'HTML' format
but the text is a separate part for e-mail readers that don't understand
HTML. We can't assume that all valid HTML is XML so we have to escape all of
the HTML ... or use a CDATA section
]]></mime:BODY>
</MIME>
<MIME>
<Content-Type charset="iso-8859-1">text/html</Content-Type>
<Content-transfer-encoding>binary</Content-transfer-encoding>
<mime:BODY xmlns="">
<![CDATA[<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D'"MSHTML 5.00.0910.1309"' name=3DGENERATOR></HEAD>
<BODY bgColor=3D#ffffff>
<P><FONT size=3D2>Here is the text of the message ... its being
=
transmitted in=20
'HTML' format but the text is a separate part for e-mail readers that =
don't=20
understand HTML. We can't assume that all valid HTML is XML so we
=
have to=20
escape all of the HTML ... or use a CDATA=20
section<BR> <BR><BR> =20
</FONT></P></BODY></HTML>]]></mime:BODY>
</MIME>
</Parts>
</mime:BODY>
</MIME>
The XMTP test facility was programmed using the XTRIME SSMTP server and the following script:
<?XTRIME Language="JavaScript" ?>
var SMTP = Ctx.CreateInstance("XTRIME.SMTPMessage.1");
var MIME = SMTP.MIME;
SMTP.To = Request.Header("From"); // reply back to the sender
SMTP.From = Request.Header("To");
MIME.Header("Content-Type") = "text/plain"; // send the reply back as the body of the message
MIME.Header("MIME-Version") = "1.0"; // always
MIME.Header("Reply-To") = "<jborden@mediaone.net>"; // any questions go to me :-))
Request.MessageType = 3; // this means use XML format for the MIME message
SMTP.Body = Request; // this 'assigns' the body of the SMTP message to the MIME Request ...
SMTP.Send(); // send it
Ctx.Commit(); // commit the transaction and *really* do it
Tthe XMTP protocol is demonstrated in action by sending a message to:
test-xmtp@jabr.ne.mediaone.net
When the XMTP server gets the message, it runs the above script which generates the E-mail reply. In this case the body of the message is the request transformed into XML.
The XMTP-BOARD is an XML/XSL e-mail demonstration system. Post a message by sending E-mail, including attached GIF and JPEG images to: mailto:xmtp-board@jabr.ne.mediaone.net.
The board can be viewed by browing the link: http://jabr.ne.mediaone.net/xmtp/listxmtp.asp?User=xmtp-board
This demo employs XML and IE5b2's version of XSL. A server side XSL transformation which can be viewed in non XML/XSL browsers cane be viewed here.