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>[email protected]</from>
<to>[email protected]</to>
<subject>Foo</subject>
<body>Bar</body>
</email>
... and so on, enough to do the job required of it. Often, these would 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