我有两个问题。
1)收到电子邮件后,它不会捕获正文中的html
2)它只发送电子邮件给收件人info@info.com而不是info2@info.com
其他一切正常。
$to = 'info@info.com, info2@info.com';
$subject = "New interested recruiter: " .$cleanEmail. "";
$header = "From: info@info.com";
$header .= "Reply-To: info@info.com";
$header .= "Content-type: text/html; charset=iso-8859-1\r\n";
$message = "<html>";
$message .= "<body>";
$message = "New interested recruiter: ".$cleanEmail."<br><br>";
$message .= $cleanMessage;
$message .= "</body>";
$message .= "</html>";
mail($to, $subject, $message, $header) or die ("Failure");
提前致谢
答案 0 :(得分:2)
这里有一些问题。
The manual for the mail()
function states:
// multiple recipients
$to = 'aidan@example.com' . ', '; // note the comma
$to .= 'wez@example.com';
因此,请按手册说明。
以及使用MIME :(也来自手册)......
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
然后缺少的连接正在打破你的消息变量
$message = "New interested recruiter: ".$cleanEmail."<br><br>";
^ missing dot
答案 1 :(得分:1)
尝试添加这样的标题..
$header = "From: info@info.com\r\n";
$header .= "Reply-To: info@info.com\r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-type: text/html; charset: utf8\r\n";