當我嘗試使用的PHPMailer類我得到這個錯誤發送電子郵件: 梅勒錯誤:郵件正文爲空:PHP梅勒類問題:郵件正文空
<?php
include("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl";
$mail->Host = "rsb20.rhostbh.com";
$mail->Port = 465;
$mail->Username = "jobserreker+furrtexlab.com";
$mail->Password = "12345678a";
$mail->From = "[email protected]";
$mail->FromName = "Job Seeker";
$mail->Subject = $_GET['subject'];
$mail->MsgHTML($_GET['msg']);
$mail->AddAddress($_GET['to'],"name to");
$mail->IsHTML(false);
if(!$mail->Send())
{
echo "Mailer Error: " . $mail->ErrorInfo;
}else{
echo "Message sent!";
}
?>
任何機會$ _GET ['msg']爲空? – unfrev 2012-07-16 14:45:29
如果您使用$ mail-> MsgHTML($ _ GET ['msg']);但接着說$ mail-> IsHTML(false);你是不是應該使用其他屬性來設置文本?像Body這樣的屬性?或者也許$ _GET ['msg']是空的? – 2012-07-16 14:46:20
你可以請'回聲'--->'。 $ _GET ['msg']。 '<---',爲了檢查'$ _GET ['msg']'的內容? – fsenart 2012-07-16 14:47:51