我正在尝试使用swift mailer发送大量电子邮件,我一次必须发送2500封电子邮件,但是我无法发送30封以上的电子邮件,我使用的是以下代码
$sql = $db->Query("SELECT * FROM customer_data WHERE c_status=?", array("0"));
while($row=$db->FetchRow($sql)){
$body="Test body";
// Create a message
$message = (new Swift_Message('test subject'))
->setFrom(['no_reply@xxx.com' => 'xxxx Group'])
->setTo([$row['c_email']])
->setBody($body, 'text/html')
;
// Send the message
$result = $mailer->send($message);
}
30封电子邮件后,我收到类似
的错误致命错误:未捕获的Swift_TransportException:预期的响应代码 250,但收到空回应 C:.. \ vendor \ swiftmailer \ swiftmailer \ lib \ classes \ Swift \ Transport \ AbstractSmtpTransport.php:445 堆栈跟踪:#0 C:.. \ vendor \ swiftmailer \ swiftmailer \ lib \ classes \ Swift \ Transport \ AbstractSmtpTransport.php(341): Swift_Transport_AbstractSmtpTransport-> assertResponseCode('',数组) 1 C:.. \ vendor \ swiftmailer \ swiftmailer \ lib \ classes \ Swift \ Transport \ EsmtpTransport.php(305): Swift_Transport_AbstractSmtpTransport-> executeCommand('MAIL FROM:executeCommand('DATA \ r \ n',Array, 阵列)#3 C:.. \ vendor \ swiftmailer \ swiftmailer \ lib \ classes \ Swift \ Transport \ AbstractSmtpTransport.php(497): Swift_Transport_A在 C:.. \ vendor \ swiftmailer \ swiftmailer \ lib \ classes \ Swift \ Transport \ AbstractSmtpTransport.php 在第445行
任何建议将不胜感激。