Пример #1
0
 /**
  * Decorate $email with categories.
  *
  * @param EmailInterface $email
  *
  * @return EmailInterface|EmailDecorator
  */
 protected function decorateWithCategories(EmailInterface $email)
 {
     if (!$email instanceof EmailDecorator) {
         $email = new EmailDecorator($email);
     }
     if (!is_null($this->categories)) {
         $email->setCategories($this->categories);
     }
     return $email;
 }
Пример #2
0
 /**
  * {@inheritdoc}
  */
 public function prepare($from, $fromName, array $to, $subject, $body, array $attachments = [], array $options = [])
 {
     $this->resolveOptions($options);
     $email = new Email($from, $fromName, $to, $subject, $body, htmlspecialchars($body));
     if (!empty($attachments)) {
         foreach ($attachments as $attachment) {
             $email->addAttachment($attachment);
         }
     }
     if (!is_null($this->sendAt)) {
         $email = new EmailDecorator($email);
         $email->setSendAt($this->sendAt);
     }
     $this->addEmail($email);
     return $this;
 }