【发布时间】:2013-11-20 00:08:35
【问题描述】:
$subject = 'Test';
$body = '<html>
<head>
<title>Birthday Reminders for August</title>
</head>
<body>
<a href="http://lancenewman.me">Test</a>
</body>
</html>';
$headers = 'MIME-Version: 1.0' . '\r\n';
$headers .= 'Content-type: text/html; charset=iso-8859-1' . '\r\n';
$headers .= 'From: Lance <support@lancenewman.me>' . '\r\n';
$headers .= 'To: User <email@me.com>' . '\r\n';
//echo $headers;
mail('myemail@me.com', $subject, $body, $headers)or die('error');
电子邮件已发送,但 to 和 from 标头未正确显示。 Gmail 说电子邮件发送到我的电子邮件,但不是我的名字(Lance),就像它应该的那样。 from 标头也是如此。此外,所有 html 标签都显示在电子邮件中。
有什么想法吗?
【问题讨论】:
-
再试一次,但这次将
error_reporting(E_ALL);放在代码上方。 -
通常当您看到 html 标签出现时,这意味着它们要么是无效标签,要么是格式不正确 - 它们显然没有被正确读取。您是否尝试过通过 xhtml 检查器扔 html 来查看是否有任何无效的内容?
-
为什么要设置在标题中。什么时候是 mail 函数的第一个参数?
-
我不知道你想说什么,乔尼
-
email变量包含什么?
标签: php html-email