2011-08-09 11 views
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はこのメールを失敗として認識せず、入力しません$failedRecipientsArray

答えて

3

Swiftmailerは、電子メールをメールサーバーに渡すだけです。他のすべてはSwiftmailerとは関係ありません。

メールが実際にはの最初のサーバーで拒否されなかった構文上のメールアドレスだったため、バウンスメッセージが表示され、自分で処理する必要があります。

btwは、他のメーリングリストのライブラリであり、PHPでもmailの機能です。バウンス処理アプリケーションまたはコードを探している可能性があります。

関連:Bounce Email handling with PHP?

+1

その通り。メールサーバが最初にメッセージを受け入れるなら、SwiftMailer(または他のライブラリ)ができることは何もありません。 –

関連する問題