开发者

Are there any standards for structured email templates?

开发者 https://www.devze.com 2022-12-09 01:34 出处:网络
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). Prev

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消