Я пробую этот код (из http://swiftmailer.org/docs/sending.html) :
require_once 'lib/swift_required.php';
//Create the Transport
$transport = Swift_SmtpTransport::newInstance('localhost', 25);
//Create the Mailer using your created Transport
$mailer = Swift_Mailer::newInstance($transport);
//Create a message
$message = Swift_Message::newInstance('Wonderful Subject')
->setFrom(array('[email protected]' => 'John Doe'))
->setBody('Here is the message itself')
;
//Send the message
$failedRecipients = array();
$numSent = 0;
$to = array('[email protected]', '[email protected]' => 'A name');
foreach ($to as $address => $name)
{
$message->setTo(array($address => $name));
$numSent += $this->send($message, $failedRecipients);
}
printf("Sent %d messages\n", $numSent);
Проблема в том, что если я отправил электронное письмо на плохой домен, swiftmailer распознает его как правильное отправленное письмо, и $failedRecipients
будет пустым. В свой почтовый ящик я отправил уведомление об отказе.
Почему Swiftmailer не распознает это письмо как неисправное и не заполняет $failedRecipients
Array
?