/**
  * @param EmailTemplateRepository $repository
  */
 public function postSend(EmailTemplateRepository $repository)
 {
     $subject = $this->getRequiredParameter('subject');
     $to = $this->getRequiredParameter('to');
     $body = $this->getRequiredParameter('message');
     $parameters = $repository->instance(['subject' => $subject, 'email_to' => $to, 'email_from' => config('mail.default')]);
     $this->setContent(['send' => EmailSender::send($body, $parameters)]);
 }
 public function send()
 {
     $sent = EmailSender::send($this->body, $this->parameters, $this->message_type);
     $this->attempts++;
     if ($sent) {
         $this->status = static::STATUS_SENT;
     } elseif ($this->attempts >= config('email_queue.max_attempts')) {
         $this->status = static::STATUS_FAILED;
     }
     $this->save();
 }
 /**
  * @param array $options
  *
  * @return bool|EmailTemplate
  */
 public function send($options = [])
 {
     $options = $this->prepareOptions($options);
     $this->prepareInnerValues($options);
     if ($this->use_queue) {
         return $this->addToQueue($options);
     } else {
         return EmailSender::send($this->message, $this, $this->message_type);
     }
 }