微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在电子邮件主题[PHP]中包含html标签

使用标头,将在“邮件内容/正文”中解析html标签,但是如果我们希望在“邮件主题”中包含一些html标签,该怎么办.有什么办法吗

解决方法:

即使您将html标签放在邮件主题中,邮件客户端也不会将其呈现为html.

根据电子邮件RFC,电子邮件主题不能具有内容类型

来自RFC http://www.w3.org/Protocols/rfc822/

3.1.2. STRUCTURE OF HEADER FIELDS

Once a field has been unfolded, it may be viewed as being composed of a field-name followed by a colon (":"), followed by a field-body, and terminated by a carriage-return/line-Feed. The field-name must be composed of printable ASCII characters (i.e., characters that have values between 33. and 126., decimal, except colon). The field-body may be composed of any ASCII characters, except CR or LF. (While CR and/or LF may be present in the actual text, they are removed by the action of unfolding the field.)
Certain field-bodies of headers may be interpreted according to an internal Syntax that some systems may wish to parse. These fields are called "structured fields". Examples include fields containing dates and addresses. Other fields, such as "Subject" and "Comments", are regarded simply as strings of text.

Note:

Any field which has a field-body that is defined as other than simply <text> is to be treated as a structured field.
Field-names, unstructured field bodies and structured field bodies each are scanned by their own, independent "lexical" analyzers.

3.1.3. UNSTRUCTURED FIELD BODIES

For some fields, such as "Subject" and "Comments", no structuring is assumed, and they are treated simply as <text>s, as in the message body. Rules of folding apply to these fields, so that such field bodies which occupy several lines must therefore have the second and successive lines indented by at least one LWSP-char.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐