PHP,PHPMailer:无法获取PHPMailer的示例代码

dav*_*mcd 1 php smtp phpmailer

我正在尝试让php邮件工作.我收到错误但无法从谷歌上找到任何信息.

$mail = new phpmailer;

$mail->IsSMTP(); // set mailer to use SMTP
$mail->SMTPSecure = "ssl";
$mail->Host = "smtp.gmail.com";
$mail->Port = 465;

$mail->From = "from@email.com";
$mail->FromName = "Mailer";
$mail->AddAddress("user@theirsite.com", "User");
//$mail->AddAddress("ellen@site.com");   // name is optional
$mail->AddReplyTo("info@site.com", "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
Run Code Online (Sandbox Code Playgroud)

上面的代码是我正在使用的但是当我尝试运行它时,我在浏览器中得到以下内容...

Fatal error: Cannot access empty property in /the/full/path/to/phpmailer.inc.php on line 271
Run Code Online (Sandbox Code Playgroud)

这是它所指的线......

$header[] = sprintf("Content-Transfer-Encoding: %s\n", $this->$Encoding);
Run Code Online (Sandbox Code Playgroud)

如果有人可以提供帮助,将不胜感激!谢谢.

Ben*_*Ben 6

Encoding 不是变量: $this->Encoding

  • 很疯狂,我从他们的网站下载了它,我猜他们搞砸了因为我没有编辑那个文件.谢谢您的帮助. (2认同)