protected function sendEmails(Swift_Transport $transport, &$failedRecipients, array $emails)
    {
        $count = 0;
        $time = time();
        $emails = $this->prepareEmails($emails);
        $skip = false;

        foreach ($emails as $email) {
            if ($skip) {
                $email->setStatus(SpoolEmailStatus::STATUS_FAILED);
                $email->setStatusMessage('The time limit of execution is exceeded');

                continue;
            }

            $count += $this->sendEmail($transport, $email, $failedRecipients);
            $this->flushEmail($email);

            if ($this->getTimeLimit() && (time() - $time) >= $this->getTimeLimit()) {
                $skip = true;
            }
        }

        return $count;
    }
protected function sendEmails(Swift_Transport $transport, &$failedRecipients, array $emails)
    {
        $count = 0;
        $time = time();
        $emails = $this->prepareEmails($emails);
        $skip = false;

        foreach ($emails as $email) {
            if ($skip) {
                $email->setStatus(SpoolEmailStatus::STATUS_FAILED);
                $email->setStatusMessage('The time limit of execution is exceeded');

                continue;
            }

            $count += $this->sendEmail($transport, $email, $failedRecipients);
            $this->flushEmail($email);

            if ($this->getTimeLimit() && (time() - $time) >= $this->getTimeLimit()) {
                $skip = true;
            }
        }

        return $count;
    }
protected function sendEmails ( Swift_Transport $ transport , & $ failedRecipients , array $ emails ) { $ count = 0 ; $ time = time ( ) ; $ emails = $ this -> prepareEmails ( $ emails ) ; $ skip = false ; foreach ( $ emails as $ email ) { if ( $ skip ) { $ email -> setStatus ( SpoolEmailStatus :: STATUS_FAILED ) ; $ email -> setStatusMessage ( 'The time limit of execution is exceeded' ) ; continue ; } $ count += $ this -> sendEmail ( $ transport , $ email , $ failedRecipients ) ; $ this -> flushEmail ( $ email ) ; if ( $ this -> getTimeLimit ( ) && ( time ( ) - $ time ) >= $ this -> getTimeLimit ( ) ) { $ skip = true ; } } return $ count ; }
Send the emails message.

@param \Swift_Transport      $transport        The swift transport
@param null|string[]         $failedRecipients The failed recipients
@param SpoolEmailInterface[] $emails           The spool emails

@return int The count of sent emails
Send the emails message .