Exemple #1
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 #2
0
 /**
  * @param EmailInterface $email
  * @return string
  */
 protected function buildHeaders(EmailInterface $email)
 {
     $headers = ["From: " . $email->getFrom()];
     if ($email->getReplyTo() !== null) {
         $headers[] = "Reply-To: " . $email->getReplyTo();
     }
     if ($email->getMimeVersion() !== null) {
         $headers[] = "MIME-VERSION: " . $email->getMimeVersion();
     }
     if ($email->getContentType() !== null) {
         $headers[] = "Content-Type: " . $email->getContentType();
     }
     if ($email->getCc() !== null) {
         $headers[] = "Cc: " . $email->getCc();
     }
     if ($email->getBcc() !== null) {
         $headers[] = "Bcc: " . $email->getBcc();
     }
     if ($email->getXMailer() !== null) {
         $headers[] = "X-Mailer: " . $email->getXMailer();
     }
     return implode("\r\n", $headers);
 }