/**
  * Constructs a single string from the email body and headers.
  *
  * @param string         $body
  * @param EmailInterface $email
  * @return string
  */
 protected function buildMessage($body, EmailInterface $email)
 {
     $message = "To: " . $email->getTo() . "\r\n";
     $message .= "Subject: " . $email->getSubject() . "\r\n";
     $message .= $this->buildHeaders($email) . "\r\n";
     $message .= $body;
     return $message;
 }
Exemple #2
0
 /**
  * @param string         $body
  * @param EmailInterface $email
  * @return boolean
  */
 protected function doSend($body, EmailInterface $email)
 {
     /** @var SendGridEmail $sendgridEmail */
     $sendgridEmail = new SendGridEmail();
     $sendgridEmail->addTo($email->getTo())->setFrom($email->getFrom())->setSubject($email->getSubject())->addCc($email->getCc())->setBcc($email->getBcc())->setHtml($body);
     /** @var Response $res */
     $res = static::getSendGrid()->send($sendgridEmail);
     return $res->getCode() === 200;
 }
Exemple #3
0
 /**
  * @param string         $body
  * @param EmailInterface $email
  * @return boolean
  */
 protected function doSend($body, EmailInterface $email)
 {
     return mail($email->getTo(), $email->getSubject(), $body, $this->buildHeaders($email));
 }