protected function logSend($result, $mailer)
    {
        if ($this->log() === false) {
            return;
        }

        if (!$result) {
            $this->logger->error('Email could not be sent.');
        } else {
            $this->logger->debug(
                sprintf('Email "%s" sent successfully.', $this->subject()),
                $this->to()
            );
        }

        $recipients = array_merge(
            $this->to(),
            $this->cc(),
            $this->bcc()
        );

        foreach ($recipients as $to) {
            $log = $this->logFactory()->create('charcoal/email/email-log');

            $log->setType('email');
            $log->setAction('send');

            $log->setRawResponse($mailer);

            $log->setMessageId($mailer->getLastMessageId());
            $log->setCampaign($this->campaign());

            $log->setSendDate('now');

            $log->setFrom($mailer->From);
            $log->setTo($to);
            $log->setSubject($this->subject());

            $log->save();
        }
    }
protected function logSend($result, $mailer)
    {
        if ($this->log() === false) {
            return;
        }

        if (!$result) {
            $this->logger->error('Email could not be sent.');
        } else {
            $this->logger->debug(
                sprintf('Email "%s" sent successfully.', $this->subject()),
                $this->to()
            );
        }

        $recipients = array_merge(
            $this->to(),
            $this->cc(),
            $this->bcc()
        );

        foreach ($recipients as $to) {
            $log = $this->logFactory()->create('charcoal/email/email-log');

            $log->setType('email');
            $log->setAction('send');

            $log->setRawResponse($mailer);

            $log->setMessageId($mailer->getLastMessageId());
            $log->setCampaign($this->campaign());

            $log->setSendDate('now');

            $log->setFrom($mailer->From);
            $log->setTo($to);
            $log->setSubject($this->subject());

            $log->save();
        }
    }
protected function logSend ( $ result , $ mailer ) { if ( $ this -> log ( ) === false ) { return ; } if ( ! $ result ) { $ this -> logger -> error ( 'Email could not be sent.' ) ; } else { $ this -> logger -> debug ( sprintf ( 'Email "%s" sent successfully.' , $ this -> subject ( ) ) , $ this -> to ( ) ) ; } $ recipients = array_merge ( $ this -> to ( ) , $ this -> cc ( ) , $ this -> bcc ( ) ) ; foreach ( $ recipients as $ to ) { $ log = $ this -> logFactory ( ) -> create ( 'charcoal/email/email-log' ) ; $ log -> setType ( 'email' ) ; $ log -> setAction ( 'send' ) ; $ log -> setRawResponse ( $ mailer ) ; $ log -> setMessageId ( $ mailer -> getLastMessageId ( ) ) ; $ log -> setCampaign ( $ this -> campaign ( ) ) ; $ log -> setSendDate ( 'now' ) ; $ log -> setFrom ( $ mailer -> From ) ; $ log -> setTo ( $ to ) ; $ log -> setSubject ( $ this -> subject ( ) ) ; $ log -> save ( ) ; } }
Log the send event for each recipient.

@param  boolean $result Success or failure.
@param  mixed   $mailer The raw mailer.
@return void
Log the send event for each recipient .