我正在使用Swiftmailer PHP版本4.3.0,我想在BCC中发送一封包含1500个电子邮件地址的电子邮件。Swiftmailer只发送来自BCC的999封电子邮件
我的服务器上的限制允许我可以在24小时内发送多达10000封电子邮件。我没有超过这个限制。
然而,当我尝试使用Swiftmailer发送电子邮件返回以下错误消息(详见下文)
“
“421个在这方面过多的信息”和BCC中的1500个电子邮件地址中只有999封电子邮件会收到该电子邮件。 我多次执行此实验,同时将BBC中的电子邮件数量更改为1000或2000 - 每次发送999封电子邮件。是否有可能在Swiftmailer的某处存在限制,它不允许在BCC中设置超过999个电子邮件地址?如果是这样,是否有可能改变这个限制?如果不是,还有什么可能导致这个问题?
这里是Swiftmailer完整的错误消息:
异常“Swift_TransportException”有消息“期望的回应 代码250,但得到的代码‘421’,在 消息“421个邮件太多该连接“”在 /is/htdocs/www/swift/lib/classes/Swift/Transport/AbstractSmtpTransport.php:386 堆栈跟踪:
#0 /是/ htdocs中/ WWW /快捷/ lib中/班/雨燕/运输/ A bstractSmtpTransport.php(281): Swift_Transport_AbstractSmtpTransport - > _ assertResponseCode( '421太 许多我......',阵列)
#1 /是/ htdocs中/ WWW /快捷/ lib中/班/雨燕/运输/ EsmtpTransport .PHP(245): Swift_Transport_AbstractSmtpTransport-> executeCommand( 'MAIL FROM: executeCommand(' MAIL FROM:_doMailFromCommand('[email protected] ...')
#4 /是/ htdocs中/ WWW /迅速/lib/classes/Swift/Transport/AbstractSmtpTransport.php(466): Swift_Transport_AbstractSmtpTransport - > _ doMailTransaction(Object(Swift_Message), '[email protected] ...',Array,Array)
#5 /is/htdocs/www/swift/lib/classes/Swift/Transport/AbstractSmtpTransport.php(178): Swift_Transport_AbstractSmtpTransport - > _ sendBcc(对象(Swift_Message), “[email protected] ... ”,阵列,阵列)
#6 /is/htdocs/www/swift/lib/classes/Swift/Mailer.php(86):Swift_Transport_AbstractSmtpTransport->发送(对象(Swift_Message) 阵列)
#7 /is/htdocs/www/swift/lib/swift_required.php(133):Swift_Mailer->发送(对象(Swift_Message))
#8 /is/htdocs/www/mydomain.net/test。PHP(21):的sendMessage()
#9 {主}
执行此代码时:
/*
* Autoloader and dependency injection initialization for Swift Mailer.
*/
if (defined('SWIFT_REQUIRED_LOADED')) {
return;
}
define('SWIFT_REQUIRED_LOADED', true);
//Load Swift utility class
require dirname(__FILE__) . '/classes/Swift.php';
if (!function_exists('_swiftmailer_init')) {
function _swiftmailer_init()
{
require dirname(__FILE__) . '/swift_init.php';
}
}
//Start the autoloader and lazy-load the init script to set up dependency injection
Swift::registerAutoload('_swiftmailer_init');
sendMessage();
function sendMessage(){
try{
// LARGE ARRAY with 1500 entries
$bcc = array("[email protected]","[email protected]", ... , "[email protected]")
// Create the Transport
$transport = Swift_SmtpTransport::newInstance('***', 25);
$transport->setUsername('***');
$transport->setPassword('***');
// Create the Mailer using your created Transport
$mailer = Swift_Mailer::newInstance($transport);
// Create the message
$message = Swift_Message::newInstance();
// Give the message a subject
$message->setSubject("This is a test mail");
// Set the From address with an associative array
$message->setFrom(array('[email protected]' => 'My Name'));
$message->setTo("[email protected]");
$message->setBcc($bcc);
$message->setBody("Hi, this is a test mail. Enjoy.");
$result = $mailer->send($message);
echo "Success";
}
catch(Exception $exception)
{
echo $exception;
}
}
这是你的服务器的另一个限制,最多1000个目的地(在你的情况下1个主+ 999 BCC)。 – Gar