views:

53

answers:

3

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
+1  A: 

Not sure if it's applicable, or if it's really a wide standard, but perhaps microformats would be useful?

http://microformats.org/

DA
Interesting, I hadn't seen that before. There doesn't seem to be one specifically for email, but I can see where it would fit in.
skaffman
+1  A: 

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.

Donut
+1  A: 

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.

pmf