Working with failedrecipients

Swift Mailer is a fantastic library for sending email with php. Discuss this library or ask any questions about it here.

Moderators: Chris Corbyn, General Moderators

Post Reply
everisk
Forum Newbie
Posts: 11
Joined: Sat Mar 21, 2009 9:32 am

Working with failedrecipients

Post by everisk »

Hello,

I'm on 3.3.3 and would like to get the error response code like [550 5.1.1] and error message like below (got from dumping log file)
!!Expected response code(s) [250] but got response [550 5.1.1 <email@email.com> User unknown; rejecting]
!!Recipient 'email@email.com' rejected by connection.

However, I'd need to get this the sendPerformed function .. any help is greatly appreciated

Code: Select all

 
class SwiftReportGeneratorPlugin implements Swift_Events_SendListener
{ 
   public function sendPerformed(Swift_Events_SendEvent $e){
             $recipients = $e->getRecipients();
             $to = array_keys($recipients->getTo());
             $sent['to'] = $to[0];  //email
             $sent['success'] = $e->getNumSent();  // number of email sent, with batchSend it's always 1 if success, 0 if failed
 
            $message = $e->getMessage();
 
                       // got failed recipient with no problem
                      // HELP : would like to get error code and error message
                      // By the way, I use send() to send message
            print_r($e->getFailedRecipients());
            
            print " this is done $sent[to] $sent[success]";
 
 
}
 
Last edited by Benjamin on Mon May 18, 2009 10:39 am, edited 1 time in total.
Reason: Changed code type from text to php.
Post Reply