【发布时间】:2011-09-27 19:45:16
【问题描述】:
奇怪的事情发生在我身上。我正在尝试使用 php mail() 函数发送 HTML 邮件,但这里没有运气。即使我从字面上复制/粘贴一段代码,它也不起作用。我究竟做错了什么?这是我使用的一段代码:
$message = "<html><body>";
$message .= "<table rules='all' style='border-color: #666;' cellpadding='10'>";
$message .= "<tr style='background: #eee;'><td><strong>Name:</strong> </td></tr>";
$message .= "<tr><td><strong>Email:</strong> </td></tr>";
$message .= "</table>";
$message .= "</body></html>";
$to = 'me@gmail.com';
$subject = 'Website Change Reqest';
$headers = "From: " . $email . "\r\n";
$headers .= "Reply-To: ". $email . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
if (mail($to, $subject, $message, $headers)) {
echo 'Your message has been sent.';
} else {
echo 'There was a problem sending the email.';
}
这就是我的电子邮件的样子...:
Reply-To: me@gmail.com
MIME-Version: 1.0
Content-Type: text/html; charset=ISO-8859-1
Message-Id: <20110703234551.A9D6153DAB@apache10.hostbasket.com>
Date: Mon, 4 Jul 2011 01:45:51 +0200 (CEST)
<html><body><table rules="all" style="border-color: #666;" cellpadding="10"><tr style='background: #eee;'><td><strong>Name:</strong> </td></tr><tr><td><strong>Email:</strong> </td></tr><tr><td><strong>Type of Change:</strong> </td></tr><tr><td><strong>Urgency:</strong> </td></tr><tr><td><strong>URL To Change (main):</strong> </td></tr><tr><td><strong>NEW Content:</strong> </td></tr></table></body></html>
我做错了什么?
【问题讨论】:
-
您使用哪种操作系统?
-
Mac OS X 10.7 和我的电子邮件客户端是 Sparrow