ZF2邮件错误太多RSET命令

时间:2015-06-21 11:14:54

标签: zend-framework2 smtp

我必须使用ZF2发送大量分发的电子邮件,我使用的是Zend \ Mail \ Transport \ Smtp。我把邮件放在队列表中,每分钟我想发送一次。一切正常,直到第5封电子邮件,我收到错误:Zend\Mail\Protocol\Exception\RuntimeException 4.7.0 Too many RSET commands; closing connection 我想这是来自smtp服务器。但为什么ZF2-Smtp会重置每条消息?我不知道从哪里开始调试问题,如果你需要更多信息,请告诉我。感谢任何帮助...

我正在使用的是:

$transport = new SmtpTransport();
    $options = new SmtpOptions(array(
        'host' => $config['mail_options']['server'],
        'port' => $config['mail_options']['port'],
        'connection_class' => 'login',
        'connection_config' => array(
            'username' => $config['mail_options']['smtp_user'],
            'password' => $config['mail_options']['smtp_password'],
            'ssl' => $config['mail_options']['ssl'],
        ),
    ));
foreach ($queuedMails as $queuedMail) {
   $message = new Message();

            $message->addTo($data['to'])
                    ->addFrom($config['mail_options']['from'], $config['mail_options']['from_name'])
                    ->setSubject($data['subject'])
                    ->setBody(utf8_decode($data['body']))
                    ->setEncoding('utf-8');
$transport->setOptions($options);
            $transport->send($message);enter code here
}

我应该将$ transport放入foreach吗?

0 个答案:

没有答案