2
我想這個代碼(從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
?
沒錯。如果郵件服務器*首先接受郵件,SwiftMailer(或任何其他庫)就無能爲力。 –