开发者

RTF message bodies in EML files

开发者 https://www.devze.com 2023-03-20 02:42 出处:网络
We use the LumiSoft.NET MIME library to create EML files. These EML files are constructed by database values. The body of the email can be plain text, RTF, or HTML. We know when the body is HTML so, w

We use the LumiSoft.NET MIME library to create EML files. These EML files are constructed by database values. The body of the email can be plain text, RTF, or HTML. We know when the body is HTML so, when that occurs, our EML file's content-type is set with this line:

Content-Type: text/html; charset="utf-8"

When the body is plain text or RTF (because we don't know which it is), we set the content-type to RTF like so

Content-Type: text/rtf; charset="utf-8".

The HTML EML files show up just fine across different products... but the RTF EML files seem to be interpreted differently by different products. This worked for years and our resulting EML files were QA'd against Outlook Express and they appeared normally. But recently we had some customers report issues with these emails showing up with the message bodies as attachments. In Outlook 2007 SP2 and Outlook 2010, the email bodies do indeed show开发者_开发知识库 up as TXT files that are attached to the email... and the bodies inside the email itself are empty. Furthermore, we use a product called dtSearch and when it converts these EML files to HTML, it does a similar translation where the body of the EML file is shown in the content of an attachment named Attachment0.DAT. Futhermore, we also process these EML files through Outlook Redemption and, just like Outlook 2010, the message bodies are in a TXT file attachment. So weird behavior across the board... here's some screenshot of it in action.

Outlook Express:

RTF message bodies in EML files

Outlook 2010:

RTF message bodies in EML files

Here's the actual EML file.

Are we doing something wrong here by using RTF for the content type? It seems to have worked in the past and works with Outlook Express. It's been recommended to switch to the MSG format using Redemption instead of EML format to alleviate this but I believe that puts a prerequisite requirement on the user machine of either Outlook or the MAPI library.... but if the EML format isn't parsed the same by different products, then maybe the MSG format is the way to go.


The content of the email does not look like a valid rtf (No magic number "{\rtf").

It's plain text with quoted printable transfer encoding.

You should use content-type: text/plain.

0

精彩评论

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

关注公众号