我收到尝试使用PHP Mailer的错误消息。请让我知道,如果你看到什么是错的。使用PHP Mailer时出现“无法访问空属性”
Fatal error: Cannot access empty property in /hsphere/local/home/c263430/quoralist.com/includes/phpmailer/phpmailer.inc.php on line 271
phpmailer.inc.php的271行是
$header[] = sprintf("Content-Transfer-Encoding: %s\n", $this->$Encoding);
调用phpmailer.inc.php的代码是
<?php
require_once("../includes/phpmailer/phpmailer.inc.php");
require_once("../includes/phpmailer/smtp.inc.php");
$to_name = "Junk Mail";
$to = "[email protected]";
$subject = "Mail Test at ".strftime("%T", time());
$message = "This is a test.";
$message = wordwrap($message, 70);
$from_name = "Michael Mitchell";
$from = "[email protected]";
//Php mail version (default)
$mail = new PHPMailer();
//$mail->IsSMTP();
//$mail->Host = "host"
//$mail->Port = 25;
//$mail->SMTPAuth = false;
//$mail->Username = "username";
//$mail->Password = "password";
$mail->FromName = $from_name;
$mail->From = $from;
$mail->AddAddress($to, $to_name);
$mail->Subject = $subject;
$mail->Body = $message;
$result = $mail->Send();
echo $result ? 'Sent' : 'Error';
?>
EDIT
以下在一个建议的答案,我试过$this->Encoding
而不是$this->$Encoding
。当我运行它时,我收到了一条新的错误消息,不确定它是否相关。
Fatal error: Cannot redeclare class SMTP in /hsphere/local/home/c263430/quoralist.com/includes/phpmailer/smtp.inc.php on line 26
的类别在smtp.inc.php的第26行是
class SMTP {
var $SMTP_PORT = 25; # the default SMTP PORT
var $CRLF = "\r\n"; # CRLF pair
var $smtp_conn; # the socket to the server
var $error; # error if any on the last call
var $helo_rply; # the reply the server sent to us for HELO
var $do_debug; # the level of debug to perform
@迈克尔有你尝试下载更新的版本PHP梅勒的? – Daniel 2011-03-19 03:07:03
我今天下载了它。这是他们的php5/6下载。你知道我应该下载的另一个版本吗? – Leahcim 2011-03-19 03:10:30
@Michael由于某种原因,邮件的编码没有设置 – Daniel 2011-03-19 03:12:06