- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试实现 PEAR 的 Mail_Queue 包来为 Web 应用程序排队一些电子邮件。我使用了 http://pear.php.net/manual/en/package.mail.mail-queue.mail-queue.tutorial.php 上的文档编写一个小的测试脚本。
我的问题是数据库没有更新,也没有产生错误。
编辑
// mail_queue db options
$db_options['type'] = 'mdb2';
$db_options['dsn'] = DSN;
$db_options['mail_table'] = 'mail_queue';
// mail_queue sending options
$mail_options['driver'] = 'smtp';
$mail_options['host'] = 'smtp.gmail.com';
$mail_options['port'] = 25;
$mail_options['localhost'] = $host;
$mail_options['auth'] = true;
$mail_options['user'] = MAILUSER;
$mail_options['pass'] = MAILPASS;
require "Queue.php";
$mail_queue =& new Mail_Queue($db_options,$mail_options);
$from = 'someone@domain.ca';
$to = 'martin@starmedia.ca';
$message = 'This is a test';
$headers = array('From' => $from,
'To' => $to,
'Subject' => 'Someone has sent you an email!');
$mime =& new Mail_mime();
$mime->setTXTBody($message);
$body = $mime->get();
$headers = $mime->headers($headers,true);
print $mail_queue->put($from,$to,$headers,$body);
这会产生错误 Mail Queue Error: Cannot connect to database
。但是我检查了所有的连接信息,它是正确的。此外,添加 if (PEAR::isError($mail)) die($mail->getMessage());
不会产生任何错误!
最佳答案
好的,我的邮件队列文件终于可以工作了。以下是我为使其正常运行所采取的步骤:
<强>1。启用错误消息
为了启用错误处理,我添加了这个片段:
function handle_pear_error($e) {
die($e->getMessage() . ' ' . print_r($e->getUserInfo(), true));
}
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'handle_pear_error');
添加此内容后,我重新加载了页面,但出现以下错误:
Call to undefined function: MDB2_Driver_mysql::_isNewLinkSet()
<强>2。更新 MDB2 的 MySQL 驱动程序
我搜索了该错误,发现它通常是由于没有最新的 MDB2 库或其 MySQL 驱动程序造成的。
所以我更新了两者并且它工作正常!
关于php - 使用 PEAR 的 Mail_Queue 时遇到问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8882563/
我想使用 sendgrid 的 SMTP 服务器发送我的电子邮件,但是连接到它们,不是在“网络时间”,而是通过(简单)队列。 我知道 PEAR 的 Mail_Queue 可以让我做到这一点,但我可以使
我正在尝试实现 PEAR 的 Mail_Queue 包来为 Web 应用程序排队一些电子邮件。我使用了 http://pear.php.net/manual/en/package.mail.mail-
我正在使用后缀。邮件正在正确发送和接收,但我在 CentOS Web 面板的邮件队列页面上低于 PHP 通知: Notice: Undefined offset: 0 in /usr/local/cw
我是一名优秀的程序员,十分优秀!