使用脚本时,我得到以下信息:致命错误:调用未定义的方法 PEAR_Error::send()
这是我的脚本:
if ($_POST['start']){
$from = $_POST['from'];`enter code here`
$name = $_POST['fromnm'];
$msg = $_POST['msg'];
$sender = explode("\r\n", $_POST['to']);
$headers .= 'From:' . $name . "<" . $from . ">" . "\n";
$headers .= 'Reply-To:' . $from . "\n";
foreach($sender as $to) {
$smtp = Mail::factory('smtp', array(
'host' => 'ssl://smtp.gmail.com',
'port' => '465',
'auth' => true,
'username' => 'facebook.mailer.test@gmail.com',
'password' => '12563254'
));
$mail = $smtp->send($to, $headers, $msg);
if (PEAR::isError($mail)) {
echo('<p>' . $mail->getMessage() . '</p>');
} else {
echo('<script>alert("Message Sent!")');
}
}
}