Pear Mail“无法找到驱动程序smtp的类”找不到文件,在那里 [英] Pear Mail "Unable to find class for driver smtp" Cannot find file, that is there
问题描述
我的VPS正在运行CentOS 5.3。
我已经安装了pear,Mail和Net_Mail。当我尝试发送邮件时,出现找不到驱动程序smtp的类。我查看了Mail.php,发现我的梨目录中需要一个 Mail / smtp.php。我验证了php include目录,并通过chown将所有权限重置为apache。我检查了chmod,它们都是644。
My VPS is running CentOS 5.3. I have installed pear, Mail, and Net_Mail. When I try to send mail, I get, "Unable to find class for driver smtp". I looked through Mail.php, found that I need a 'Mail/smtp.php' inside my pear directory, which there is. I verified the php include directory, and I reset all of the perms to apache via chown. I checked chmod, and they are all 644.
我的代码:
$from = "Admin <admin@myemail.com>";
$to = "New User <".$email.">";
$subject = "Welcome to MyEmail!";
$body = "Thanks for choosing <MyEmail>! We strive to provide 24/7 email service and support. If you have ANY issues, concerns, etc, please reply to this email, or simply compose a new one to: myemail@email.com !";
$host = "localhost";
$username = "username";
$password = "password";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $username,
'password' => $password));
if (PEAR::isError($smtp)) {
echo("<p>" . $smtp->getMessage() . "</p>");
}
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>");
} else {
echo("<p>Message successfully sent!</p>");
}
推荐答案
您提供的代码在开头添加 require_once'Mail.php';
时在这里工作。
The code as you gave it works here, when adding require_once 'Mail.php';
at the beginning.
什么是md5哈希具有<服务器上的code> Mail / smtp.php 文件?它是否包含类Mail_smtp
行?
What md5 hash has the Mail/smtp.php
file on your server? Does it contain a class Mail_smtp
line?
这里是: 479aa21ec86e63e629db646ed292b142
(通过 md5sum /usr/share/php/Mail/smtp.php
)
这篇关于Pear Mail“无法找到驱动程序smtp的类”找不到文件,在那里的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!