Page 1 of 1

Working with failedrecipients

Posted: Mon May 18, 2009 2:10 am
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]";
 
 
}