如何使用php pear邮件 [英] how to use php pear mail
本文介绍了如何使用php pear邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用mail.php来使用PHP Pear Mail。我在test.php文件中使用以下代码:
How to include mail.php for using PHP Pear Mail. I'm using the following code in test.php file:
require_once "Mail.php";
$from = "<test@gmail.com>";
$to = "<testing@gmail.com>";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
$host = "ssl://smtp.gmail.com";
$port = "465";
$username = "<testtest@gmail.com>";
$password = "testtest";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'port' => $port,
'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>");
}
,并且通过此代码遇到以下错误:
and the following error is encountered via this code:
Warning: require_once(Mail.php) [function.require-once]: failed to open stream: No such file or directory in D:\Hosting\6525150\html\test.php on line 3
Fatal error: require_once() [function.require]: Failed opening required 'Mail.php' (include_path='.;C:\php5\pear') in D:\Hosting\6525150\html\test.php on line 3
有人可以告诉我有什么问题吗?
Can someone tell me what is the problem?
推荐答案
检查系统中是否安装了梨。如果是,则在php.ini中指定Pear安装目录的路径include_path指令
Check if pear is installed in the system . If yes then specify path to Pear installation directory in php.ini include_path directive
您需要安装PEAR和PEAR MAIL软件包才能使其正常工作
You need to install PEAR and PEAR MAIL packages to get it working
这篇关于如何使用php pear邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文