public function sendEmail(Email $email)
 {
     $apiKeys = env("SENDGRID_APIKEY");
     if (is_null($apiKeys)) {
         throw new SendgridServiceException();
     }
     if (!$email->getFrom()) {
         throw new SendgridServiceException();
     }
     $sendgrid = new \SendGrid($apiKeys);
     try {
         $sendgrid->send($email);
     } catch (\Exception $e) {
         var_dump($e->getMessage());
         throw new SendgridServiceException();
     }
 }
Exemplo n.º 2
0
 /**
  * Returns the person who sent the message.
  *
  * @return Email
  */
 public function getFrom()
 {
     return new Email($this->message->getFrom(), $this->message->getFromName());
 }