Different Content Types in email

本小妞迷上赌 提交于 2019-12-23 05:51:06

问题


I was reviewing the source of some emails sent to me and noticed in one that the content type for the text part is different from the HTML part - see below.

--_----------=_MCPart_1153762294
Content-Type: text/plain; charset="us-ascii";

--_----------=_MCPart_1153762294
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable

I was wondering if this is okay to have this? The email was sent from Monkey Wrench via MailChimp server.


回答1:


Seeing the complete headers and body would be necessary to fully answer your question, but given what we have: Yes, it's okay to have this. Presumably the message itself is multipart, and these are snippets from two of the parts in the message body.

Edit: Here's a more complete message that I shamelessly stole (from: Send Html page As Email using "mutt"). It includes all the parts you mention, and it is perfectly legit if somewhat simplistic:

Subject: test html mail
From: sender@example.com
To: recipient@example.com
Content-Type: multipart/alternative; boundary=bcaec520ea5d6918e204a8cea3b4

--bcaec520ea5d6918e204a8cea3b4
Content-Type: text/plain; charset=ISO-8859-1

*hi!*

--bcaec520ea5d6918e204a8cea3b4
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<p><b>hi!</b></p>

--bcaec520ea5d6918e204a8cea3b4--


来源:https://stackoverflow.com/questions/15566632/different-content-types-in-email

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!