【发布时间】:2011-10-30 03:55:40
【问题描述】:
我有这个脚本:
require_once "Mail.php";
$from = "Stephen <username@nvrforget.com>";//Google apps domain
$to = "username@gmail.com";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
$host = "mail.nvrforget.com";
$username = "username@nvrforget.com";
$password = "password";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>");
} else {
echo("<p>Message successfully sent!</p>");
}
我想出了这个错误:
Non-static method Mail::factory() should not be called statically
知道如何解决这个问题吗? Pear Mail 已安装在服务器上。
【问题讨论】:
-
看起来正确。你确定你的 Pear Mail 库被正确包含了吗?