batch email send with response

I want to send out batch mails using SwiftMail or any similar system. The SwiftMailer docs state that:

"Each recipient of the messages receives a different copy with only their own email address on the To: field. An integer is returned which includes the number of successful recipients."

I want to know whether it's possible to find out which email addresses failed, and optionally obtain the error reason/code.


There's a another page in the instructions there that talks about batchsend() failures and there is an example, and I suspect batchsend will be done exactly the same way.

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

$message = Swift_Message::newInstance( ... )
  ->setFrom( ... )
    '' => 'Receiver Name',
    '' => 'A name',
    '' => 'Other Name'
  ->setBody( ... )

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

Array (
  0 =>,
  1 =>

Need Your Help

How to organize unit tests and do not make refactoring a nightmare?

c# unit-testing tdd nunit code-organization

My current way of organizing unit tests boils down to the following: