我試圖讓PHP郵件程序工作。我收到一個錯誤,但無法從Google上找到任何信息。PHP,PHPMailer:無法獲取PHPMailer的示例代碼來工作
$mail = new phpmailer;
$mail->IsSMTP(); // set mailer to use SMTP
$mail->SMTPSecure = "ssl";
$mail->Host = "smtp.gmail.com";
$mail->Port = 465;
$mail->From = "[email protected]";
$mail->FromName = "Mailer";
$mail->AddAddress("[email protected]", "User");
//$mail->AddAddress("[email protected]"); // name is optional
$mail->AddReplyTo("[email protected]", "Information");
$mail->WordWrap = 50; // set word wrap
//$mail->AddAttachment("c:\\temp\\js-bak.sql"); // add attachments
//$mail->AddAttachment("c:/temp/11-10-00.zip");
$mail->IsHTML(true); // set email format to HTML
$mail->Subject = "Here is the subject";
$mail->Body = "This is the message body";
$mail->Send(); // send message
上面的代碼是我使用的是什麼,但是當我嘗試運行它,我得到我的瀏覽器下...
Fatal error: Cannot access empty property in /the/full/path/to/phpmailer.inc.php on line 271
這裏是它指的是行...
$header[] = sprintf("Content-Transfer-Encoding: %s\n", $this->$Encoding);
如果有人能幫助它將不勝感激!謝謝。
你檢查了`$ this-> Encoding`嗎?我不認爲`Encoding`是一個變量。 – Ben 2011-01-11 01:15:25