0
我正在使用PHP Swift Mailer向一组用户发送批量邮件。但我无法跟踪发送的邮件。如何跟踪使用PHP Swift Mailer发送的邮件?
我的代码:
<?php
require_once("includes/database.class.php");
require_once("lib/swift_required.php");
$con=DBClass::getConnection();
$db=DBClass::getDatabase($con);
$login_id="myloginname";
$password="mypassword";
$to_mail; //list of people
//Create the Transport
$transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 465, "ssl")
->setUsername($login_id)
->setPassword($password);
//Create the Mailer using your created Transport
$mailer = Swift_Mailer::newInstance($transport);
//Rate limit to 25 emails per-minute
$mailer->registerPlugin(new Swift_Plugins_ThrottlerPlugin(
25, Swift_Plugins_ThrottlerPlugin::MESSAGES_PER_MINUTE
));
//Create a message
$message = Swift_Message::newInstance($subject)
->setFrom($login_id)
->setTo($to_mail)
->setBody($body,
'text/html'
);
$numSent=$mailer->batchSend($message);
?>
我使用batchSend()方法来发送邮件,这给了我已发送的邮件的数量,但它不给我,一直电子邮件列表发送。怎么可能,有没有插件或功能可用?
使用Logger插件会给我日志,但我无法从中读取。
我试过,通过传递失败作为参数,并试图发送邮件[email protected]_domain.com,但没有返回我任何失败..数组为空.. – 2010-09-18 06:51:41
你使用哪个版本的Swiftmailer?如果是v3,那么你应该使用'$ mailer-> getFailedRecipients();' – Fanis 2010-09-18 07:02:54
我使用的是4.0.6版本,将$ mailer-> getFailedRecipients();在版本4工作?? – 2010-09-18 07:10:30