public function send(Email $email)
    {
        if (null === $email->getFrom()) {
            $email->setFrom($this->from);
        }
        $message = $this->mapper->fromEmail($email);

        // Try to send the mail.
        $state = $this->mailer->send($message);

        $deliveryStatus = (\Swift_Events_SendEvent::RESULT_SUCCESS === $state);

        $email->setSentState($deliveryStatus)
            ->setSentDate($deliveryStatus ? new \DateTime() : null);

        return $email;
    }
public function send(Email $email)
    {
        if (null === $email->getFrom()) {
            $email->setFrom($this->from);
        }
        $message = $this->mapper->fromEmail($email);

        // Try to send the mail.
        $state = $this->mailer->send($message);

        $deliveryStatus = (\Swift_Events_SendEvent::RESULT_SUCCESS === $state);

        $email->setSentState($deliveryStatus)
            ->setSentDate($deliveryStatus ? new \DateTime() : null);

        return $email;
    }
public function send ( Email $ email ) { if ( null === $ email -> getFrom ( ) ) { $ email -> setFrom ( $ this -> from ) ; } $ message = $ this -> mapper -> fromEmail ( $ email ) ; // Try to send the mail. $ state = $ this -> mailer -> send ( $ message ) ; $ deliveryStatus = ( \ Swift_Events_SendEvent :: RESULT_SUCCESS === $ state ) ; $ email -> setSentState ( $ deliveryStatus ) -> setSentDate ( $ deliveryStatus ? new \ DateTime ( ) : null ) ; return $ email ; }
Sends the mail updating the entity status.

@param \ProjetNormandie\EmailBundle\Entity\Email $email
@return \ProjetNormandie\EmailBundle\Entity\Email
Sends the mail updating the entity status .