我正在使用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