使用標頭,html標籤將在Mail Content/Body中解析,但是如果我們想在Mail主題中使用一些html標籤,該怎麼辦?有沒有即使你把HTML標籤在郵件主題任何出路,這在郵件主題中包含html標籤[PHP]
2
A
回答
3
,郵件客戶端將不會呈現爲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.
-1
<?php
require_once('phpmailer/class.phpmailer.php');
$ = $_POST[];
$ = $_POST[];
$ = $_POST[];
$ = $_POST[];
$mail = new PHPMailer();
$mail->CharSet = "utf-8";
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->Username = "[email protected]";
$mail->Password = "";
$mail->SMTPSecure = "ssl";
$mail->Host = "smtp.gmail.com";
$mail->Port = "465";
$mail->setFrom('emailaddress','name');
$mail->AddAddress('email address', 'name');
$mail->Subject = 'Example';
$mail->IsHTML(true);
ob_start();
?>
<html>
<head>
<title></title>
</head>
<body>
</body>
</html>
<?php
$mail->Body = ob_get_clean();
if($mail->Send())
{
header('');
}
else
{
echo "Mail Error - >".$mail->ErrorInfo;
}
?>
+0
不要發佈不能回答問題的無法解釋的隨機代碼,特別是當它是一個長期過時的示例時。 – Synchro
相關問題
- 1. PHP包含和Meta標籤
- 2. 如何在html中的section標籤內包含div標籤
- 3. 在Rails郵件程序中包含ERB主題行
- 4. 檢測在包含HTML標籤
- 5. 使用PHP保存包含輸入標籤值的HTML文件
- 6. Php包括和html標籤
- 7. 匹配電子郵件地址不包含在HTML標記中
- 8. 包含HTML正文的JSP包含HTML BODY標籤嗎?
- 9. php包含在html文件目錄中
- 10. simplexml_load_file:如果主標籤包含東西
- 11. PHP:電子郵件主題
- 12. 查詢篩選出包含HTML標籤
- 13. 在PHP中包含問題
- 14. PHP郵件標題問題
- 15. 如何在URL中包含wordpress標題而在條件標籤中使用echo?
- 16. XSL:僅在原始文件包含該標籤時才包含標籤
- 17. pyspark:查找包含單詞/主題標籤的鳴叫數
- 18. 通過電子郵件發送HTML表單提交時包含標籤值
- 19. 包含簽名的電子郵件
- 20. 在html文件中包含html文件
- 21. 在每個文件中包含標題php
- 22. Spring + thymeleaf html電子郵件模板,如何在郵件中添加html標籤?
- 23. Django包含標籤
- 24. PHP文件包含問題
- 25. php插件/包含問題
- 26. 在電子郵件中包含HTML文件
- 27. Django:密碼重置電子郵件主題行包含'example.com
- 28. 從包含img標籤的iPhone應用發送電子郵件
- 29. javascript-<span>包含HTML標籤的文本塊在IE中
- 30. 如何在wordpress摘錄中包含html標籤?
一些電子郵件應用呈現HTML,有些不是。 – fico7489
...但沒有電子郵件應用程序在主題行中呈現HTML。 – Synchro