2010-07-18 164 views
0

我想發送使用SwiftMail或任何類似系統的批量郵件。 SwiftMailer文檔陳述如下:批量電子郵件發送回覆

「郵件的每個收件人都會收到一個不同的副本,並且收件人字段上只有自己的電子郵件地址。返回的整數包括成功收件人的數量。

http://swiftmailer.org/docs/batchsend-method

我想知道是否有可能找出哪些郵件地址失敗,以及可選獲取錯誤的原因/代碼。

回答

1

那裏面有指令的另一頁,大約batchsend會談()失敗http://swiftmailer.org/docs/finding-failures並且有一個example我懷疑batchsend會做完全相同的方式

$mailer = Swift_Mailer::newInstance(...); 

$message = Swift_Message::newInstance(...) 
    ->setFrom(...) 
    ->setTo(array(
    '[email protected]-domain.org' => 'Receiver Name', 
    '[email protected]' => 'A name', 
    '[email protected]' => 'Other Name' 
)) 
    ->setBody(...) 
    ; 

//Pass a variable name to the send() method 
if (!$mailer->send($message, $failures)) 
{ 
    echo "Failures:"; 
    print_r($failures); 
} 

/* 
Failures: 
Array (
    0 => [email protected], 
    1 => [email protected] 
) 
*/ 
+0

我明白了。所以我不認爲它可以返回失敗的原因? – GSTAR 2010-07-18 22:04:14

+0

對不起,我不知道。 – 2010-07-18 22:49:43