[英]Error message on sending test message with PEAR mail
我已经安装了最新版本的PEAR Mail和Mail_Mime,并且正在尝试使用此页面上的以下测试电子邮件发送测试消息,即
<?
include('/home/****/php/Mail.php');
include('/home/****/php/Mail/mime.php');
// Constructing the email
$sender = "**** <info@****.com>"; // Your name and email address
$recipient = "**** <****@gmail.com>"; // The Recipients name and email address
$subject = "Test Email"; // Subject for the email
$text = 'This is a text message.'; // Text version of the email
$html = '<html><body><p>This is a html message</p></body></html>'; // HTML version of the email
$crlf = "\n";
$headers = array(
'From' => $sender,
'Return-Path' => $sender,
'Subject' => $subject
);
// Creating the Mime message
$mime = new Mail_mime($crlf);
// Setting the body of the email
$mime->setTXTBody($text);
$mime->setHTMLBody($html);
$body = $mime->get();
$headers = $mime->headers($headers);
// Sending the email
$mail =& Mail::factory('mail');
$mail->send($recipient, $headers, $body);
?>
并且消息未发送。 检查我的错误日志:
[24-Jul-2012 02:14:50] PHP致命错误:/ home / * * / php / Mail / mime.php在第1330行上调用未定义的方法Mail_mimePart :: encodeHeader()
我想知道是否有人知道此错误消息与什么有关,对此可以做什么? mime.php中的1330行是此函数的第四行:
function encodeHeader($name, $value, $charset, $encoding)
{
$mime_part = new Mail_mimePart;
return $mime_part->encodeHeader(
$name, $value, $charset, $encoding, $this->_build_params['eol']
);
}
include_once("Mail/mime.php");
应该包括在内。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.