PHP,PHPMailer:无法获取示例代码以使PHPMailer正常工作 [英] PHP, PHPMailer: Can't get example code for PHPMailer to work
本文介绍了PHP,PHPMailer:无法获取示例代码以使PHPMailer正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使php mailer正常工作.我遇到错误,但找不到来自Google的任何信息.
I'm trying to get php mailer to work. I'm getting an error but couldn't find any info from google on it.
$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
上面的代码是我正在使用的代码,但是当我尝试运行它时,我在浏览器中得到了以下内容...
The code above is what I'm using but when I try to run it I get the following in my browser...
Fatal error: Cannot access empty property in /the/full/path/to/phpmailer.inc.php on line 271
这是它所指的那一行...
Here is the line it's referring to...
$header[] = sprintf("Content-Transfer-Encoding: %s\n", $this->$Encoding);
如果有人可以提供帮助,将不胜感激!谢谢.
If anyone can help it would be greatly appreciated! Thanks.
推荐答案
Encoding
不是变量:$this->Encoding
这篇关于PHP,PHPMailer:无法获取示例代码以使PHPMailer正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文