Page 1 of 1

Log problem

Posted: Fri Aug 01, 2008 8:27 am
by Eino
Somehow failed recipients don't get logged...

Code: Select all

 
            require_once "swift/Swift.php";
            require_once "swift/Swift/Connection/SMTP.php";
                
        
            $conn =& new Swift_Connection_SMTP("xxx.xxx.xxx", xxx,  Swift_Connection_SMTP::ENC_SSL);
            $swift = new Swift($conn);
 
                        // Gives error: Call to a member function enable() on a non-object
            //$swift->log->enable();
            
            $log =& Swift_LogContainer::getLog();
            $log->setLogLevel(4);
            $log->setMaxSize(200);
            
            $message = new Swift_Message($values['subject']);
            $message->attach(new Swift_Message_Part($values['text']));
            $message->attach(new Swift_Message_Part($values['html'], "text/html"));
            
            $rList = new Swift_RecipientList();
            $rList->addTo($values['sender']);
            
            for ($i = 0; $i < count($values['recipients']); $i++)
                $rList->addBcc($values['recipients'][$i]); 
            
            $number_sent = $swift->send($message, $rList, $values['sender']);
    
        
        $fails = $log->getFailedRecipients();
        if ($fails) {
         /* ... */
                }
        
        echo '<pre>' . htmlentities($log->dump(true)) . '</pre>';
        
        return $number_sent;
 
I've got 2 valid emails and one asdfdsadf in the recipients array. I get "undelivered" -message to my box, but the log says 3/3 sent...

Re: Log problem

Posted: Fri Aug 01, 2008 7:22 pm
by EverLearning
That means that your mail server accepted all 3 mails, and later didn't succed in delivering the third mail. So as far as Swift is concerned all 3 mails were sent.

For more information on how to deal with undelivered mails, take a look at the Setting the Bounce detect, or Return-path address page in the Swift Mailer wiki.