php html 电子邮件有帮助吗?
我正在使用以下代码来处理 php html 电子邮件:
$to = $email;
$subject = 'ABC';
$message = $content;
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= 'From: ABC <[email protected]>'."\r\n";
mail($to, $subject, $message, $headers); // Send our email
我
$content='<html>
<head>
<title>Thanks</title>
</head>
<body>
<div>
<b>Thanks for your email</b>
</div>
</body>
</html>'
现在收到的电子邮件包含:
\r\n \r\n \r\n \r\n
\r\n
\r\n Thanks for your email\r\n
\r\n
\r\n
已经阅读了几个示例,就标题格式而言,我没有做任何错误。 无法识别问题,帮忙吗? 此外,任何有关实施电子通讯的帮助建议都会有所帮助。
I'm using below code for php html email:
$to = $email;
$subject = 'ABC';
$message = $content;
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= 'From: ABC <[email protected]>'."\r\n";
mail($to, $subject, $message, $headers); // Send our email
where
$content='<html>
<head>
<title>Thanks</title>
</head>
<body>
<div>
<b>Thanks for your email</b>
</div>
</body>
</html>'
Now the email received contains:
\r\n \r\n \r\n \r\n
\r\n
\r\n Thanks for your email\r\n
\r\n
\r\n
I have read several examples, I'm not doing anything wrong as far as format of header goes.
Can't identify problem, help?
Also, any help suggestions with implementation of e-newsletter would be helpful.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先,无需在 HTML 格式的邮件中使用
标签。
试试这个:
或者这个:
其中一个就可以了。
First of all no need to use
<Head>
tags in a mail formatted in HTML.Try this:
Or this:
One of them will do the trick.
可能
\n\r
被解释为编码的HTML文本..所以使用html标签
并查看\ n
may be
\n\r
are interpreted as Encoded HTML Text .. so use html tags<br>
and see for\n