使用php,并且通过此代码,我收到电子邮件作为纯文本,我错过了什么吗?因为我需要发送可能包含链接的格式化电子邮件。PHP邮件html格式不起作用
$to = "[email protected]";
$subject = "Password Recovery";
$body = '
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Birthday Reminders for August</title>
</head>
<body>
<p>Here are the birthdays upcoming in August!</p>
<table>
<tr>
<th>Person</th><th>Day</th><th>Month</th><th>Year</th>
</tr>
<tr>
<td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
</tr>
<tr>
<td>Sally</td><td>17th</td><td>August</td><td>1973</td>
</tr>
</table>
</body>
</html>
';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers = "From: [email protected]\r\n"."X-Mailer: php";
if (mail($to, $subject, $body, $headers))
echo "Password recovery instructions been sent to your email<br>";
请将其标记为答案或upvote'它是否正确'。 – GLES 2012-08-16 20:02:23