Are there any standards for structured email templates?
On a number of occasions I've found myself needing a way of representing an email message in a structured textual form inside my application (java applications, but that's not really relevant). Previously, I've used a hand-rolled XML format along the lines of:
<email>
<from>sender@domain.com</from>
<to>recipient@domain.com</to>
<subject>Foo</subject>
<body>Bar</body>
</email>
... and so on, enough to do the job required of it. Often, these woul开发者_StackOverflowd be freemarker or velocity templates, the output of which would be unmarshalled into the application and sent.
I'd really like a more off-the-shelf way of doing this. The only standards for representing the above information that I know of are the various RFCs like 822 and 5322, but parsing those is non-trivial.
Ideally, there'd be a well-designed XML schema for representing the data in internet emails. Anyone know of one?
Here are the ones mentioned so far:
- XMTP: Seems rather old, and site is not available
- James Mime4j: A low-level tool for parsing RFC 822 data
- RFC822-XML: A draft RFC for representing RFC 822 in XML
- RFC822 in RDF: A W3C draft for representing RFC 822 as RDF
XMTP (eXtensible Mail Transport Protocol) sounds like it might be what you're looking for, as it aims to be "a mapping of MIME/SMTP to XML."
However, the XMTP website appears to be down -- does anyone happen to know more about this project?
Edit:
Here's the most recent archived version of the site from the Wayback Machine.
Not sure if it's applicable, or if it's really a wide standard, but perhaps microformats would be useful?
http://microformats.org/
I'd really like a more off-the-shelf way of doing this. The only standards for representing the above information that I know of are the various RFCs like 822 and 5322, but parsing those is non-trivial.
Which is why there are libraries for it; Apache James' Mime4j does the job.
精彩评论