/**
  * Handle the event.
  *
  * @param \CachetHQ\Cachet\Bus\Events\Incident\IncidentHasReportedEvent $event
  *
  * @return void
  */
 public function handle(IncidentWasReportedEvent $event)
 {
     if (!$event->incident->notify) {
         return false;
     }
     $incident = AutoPresenter::decorate($event->incident);
     $component = AutoPresenter::decorate($event->incident->component);
     // Only send emails for public incidents.
     if ($event->incident->visible === 1) {
         foreach ($this->subscriber->isVerified()->get() as $subscriber) {
             $mail = ['email' => $subscriber->email, 'subject' => 'New incident reported.', 'has_component' => $event->incident->component ? true : false, 'component_name' => $component ? $component->name : null, 'status' => $incident->human_status, 'html_content' => $incident->formattedMessage, 'text_content' => $incident->message, 'token' => $subscriber->token, 'manage_link' => route('subscribe.manage', ['code' => $subscriber->verify_code]), 'unsubscribe_link' => route('subscribe.unsubscribe', ['code' => $subscriber->verify_code])];
             $this->mailer->queue(['html' => 'emails.incidents.new-html', 'text' => 'emails.incidents.new-text'], $mail, function (Message $message) use($mail) {
                 $message->to($mail['email'])->subject($mail['subject']);
             });
         }
     }
 }
Пример #2
0
 /**
  * Convenience function for sending mail
  *
  * @param $email
  * @param $subject
  * @param $view
  * @param array $data
  */
 public function sendTo($email, $subject, $view, $data = array())
 {
     $sender = $this->gatherSenderAddress();
     $this->mailer->queue($view, $data, function ($message) use($email, $subject, $sender) {
         $message->to($email)->from($sender['address'], $sender['name'])->subject($subject);
     });
 }
Пример #3
0
 public function handle(ModuleWasSubmittedForApproval $event)
 {
     $module = $event->module;
     $this->mailer->queue('module::emails.thank-you', compact('module'), function (Message $message) use($module) {
         $message->subject('AsgardCms: Module submitted');
         $message->to($module->user->email);
     });
 }
 /**
  * Handle the event.
  *
  * @param  BusinessWasFlagged  $event
  * @return void
  */
 public function handle(BusinessWasFlagged $event)
 {
     $data = ['user' => $event->user, 'business' => $event->business];
     $this->mailer->queue('emails.admin.business.flagged', $data, function (Message $message) {
         $message->to(env('APP_EMAIL_SENDER', 'Toilets for Trans Folk'));
         $message->from(env('APP_EMAIL_SENDER', 'TFTF Web App'));
     });
 }
 /**
  * Send notification to subscriber.
  *
  * @param \CachetHQ\Cachet\Models\Component  $component
  * @param \CachetHQ\Cachet\Models\Subscriber $subscriber
  *
  * @return \Illuminate\Database\Eloquent\Collection
  */
 public function notify(Component $component, Subscriber $subscriber)
 {
     $component = AutoPresenter::decorate($component);
     $mail = ['subject' => trans('cachet.subscriber.email.component.subject'), 'component_name' => $component->name, 'component_human_status' => $component->human_status];
     $mail['email'] = $subscriber->email;
     $mail['manage_link'] = route('subscribe.manage', ['code' => $subscriber->verify_code]);
     $this->mailer->queue(['html' => 'emails.components.update-html', 'text' => 'emails.components.update-text'], $mail, function (Message $message) use($mail) {
         $message->to($mail['email'])->subject($mail['subject']);
     });
 }
Пример #6
0
 public function create(SubmitWebsiteRequest $request)
 {
     $data = $request->all();
     $this->mailer->queue('emails.website-proposal', ['data' => $data], function (Message $message) use($data) {
         $message->to('*****@*****.**');
         $message->replyTo($data['email'], $data['name']);
         $message->subject('AsgardCms: New Website Proposal');
     });
     return response()->json('Thank you for submitting your website! We\'ll get back to your as soon as possible .');
 }
Пример #7
0
 /**
  * @param Message $message
  */
 public function created(Message $message)
 {
     if (!app()->runningInConsole()) {
         $this->mailer->queue('emails.business.message', ['msg' => $message], function (MailMessage $mail) use($message) {
             if ($message->anonymous) {
                 $mail->from(env('APP_EMAIL_SENDER'), 'Toilets For Transfolk');
             } else {
                 $mail->from($message->user->email, $message->user->name);
             }
             $mail->to($message->business->email, $message->business->name);
         });
     }
 }
 /**
  * Handle the event.
  *
  * @param \CachetHQ\Cachet\Events\IncidentHasReportedEvent $event
  */
 public function handle(IncidentHasReportedEvent $event)
 {
     $data = $this->presenter->decorate($event->incident);
     // Only send emails for public incidents.
     if ($event->incident->visible === 1) {
         foreach ($this->subscriber->all() as $subscriber) {
             $mail = ['email' => $subscriber->email, 'subject' => 'New incident reported.', 'status' => $data->humanStatus, 'htmlContent' => $data->formattedMessage, 'textContent' => $data->message, 'token' => $subscriber->token, 'unsubscribeLink' => route('unsubscribe', ['code' => $subscriber->verify_code]), 'appUrl' => env('APP_URL')];
             $this->mailer->queue(['html' => 'emails.incidents.new-html', 'text' => 'emails.incidents.new-text'], $mail, function (Message $message) use($mail) {
                 $message->to($mail['email'])->subject($mail['subject']);
             });
         }
     }
 }
Пример #9
0
 /**
  * Base send method
  *
  * @param            $to
  * @param            $subject
  * @param            $view
  * @param array      $data
  * @param array|null $cc
  * @param array|null $bcc
  *
  * @return mixed
  */
 public function send($to, $subject, $view, $data = [], $cc = [], $bcc = [])
 {
     return $this->mailer->queue($view, $data, function ($m) use($to, $subject, $cc, $bcc) {
         $m->to($to);
         if ($cc) {
             $m->cc($cc);
         }
         if ($bcc) {
             $m->bcc($bcc);
         }
         $m->subject(sprintf("[%s] %s", config('project.name'), $subject));
     });
 }
 /**
  * Handle the event.
  *
  * @param \CachetHQ\Cachet\Bus\Events\Component\ComponentWasUpdatedEvent $event
  *
  * @return void
  */
 public function handle(ComponentWasUpdatedEvent $event)
 {
     $component = AutoPresenter::decorate($event->component);
     $mail = ['subject' => trans('cachet.subscriber.email.component.subject'), 'component_name' => $component->name, 'component_human_status' => $component->human_status];
     foreach (Subscription::isVerifiedForComponent($component->id)->with('subscriber')->get() as $subscription) {
         $subscriber = $subscription->subscriber;
         $mail['email'] = $subscriber->email;
         $mail['unsubscribe_link'] = route('subscribe.unsubscribe', ['code' => $subscriber->verify_code, 'subscription' => $subscription->id]);
         $this->mailer->queue(['html' => 'emails.components.update-html', 'text' => 'emails.components.update-text'], $mail, function (Message $message) use($mail) {
             $message->to($mail['email'])->subject($mail['subject']);
         });
     }
 }
 /**
  * Handle the event.
  *
  * @param \CachetHQ\Cachet\Events\Incident\IncidentHasReportedEvent $event
  *
  * @return void
  */
 public function handle(IncidentWasReportedEvent $event)
 {
     $incident = $this->presenter->decorate($event->incident);
     $component = $this->presenter->decorate($event->incident->component);
     // Only send emails for public incidents.
     if ($event->incident->visible === 1) {
         foreach ($this->subscriber->all() as $subscriber) {
             $mail = ['email' => $subscriber->email, 'subject' => 'New incident reported.', 'has_component' => $event->incident->component ? true : false, 'component_name' => $component ? $component->name : null, 'status' => $incident->humanStatus, 'html_content' => $incident->formattedMessage, 'text_content' => $incident->message, 'token' => $subscriber->token, 'unsubscribe_link' => route('subscribe.unsubscribe', ['code' => $subscriber->verify_code]), 'app_url' => env('APP_URL')];
             $this->mailer->queue(['html' => 'emails.incidents.new-html', 'text' => 'emails.incidents.new-text'], $mail, function (Message $message) use($mail) {
                 $message->to($mail['email'])->subject($mail['subject']);
             });
         }
     }
 }
 /**
  * Handle the event.
  *
  * @param \Gitamin\Events\Issue\IssueHasAddedEvent $event
  *
  * @return void
  */
 public function handle(IssueWasAddedEvent $event)
 {
     if (!$event->issue->notify) {
         return false;
     }
     $issue = AutoPresenter::decorate($event->issue);
     $project = AutoPresenter::decorate($event->issue->project);
     // Only send emails for public issues.
     if ($event->issue->visible === 1) {
         foreach ($this->subscriber->all() as $subscriber) {
             $mail = ['email' => $subscriber->email, 'subject' => 'New issue reported.', 'has_project' => $event->issue->project ? true : false, 'project_name' => $project ? $project->name : null, 'status' => $issue->humanStatus, 'html_content' => $issue->formattedMessage, 'text_content' => $issue->message, 'token' => $subscriber->token, 'unsubscribe_link' => route('subscribe.unsubscribe', ['code' => $subscriber->verify_code])];
             $this->mailer->queue(['html' => 'emails.issues.new-html', 'text' => 'emails.issues.new-text'], $mail, function (Message $message) use($mail) {
                 $message->to($mail['email'])->subject($mail['subject']);
             });
         }
     }
 }
 /**
  * Send notification to subscriber.
  *
  * @param \CachetHQ\Cachet\Bus\Events\IncidentWasReportedEvent $event
  * @param \CachetHQ\Cachet\Models\Subscriber                   $subscriber
  *
  * @return \Illuminate\Database\Eloquent\Collection
  */
 public function notify(IncidentWasReportedEvent $event, $subscriber)
 {
     $incident = AutoPresenter::decorate($event->incident);
     $component = AutoPresenter::decorate($event->incident->component);
     $mail = ['email' => $subscriber->email, 'subject' => trans('cachet.subscriber.email.incident.subject', ['status' => $incident->human_status, 'name' => $incident->name]), 'has_component' => $event->incident->component ? true : false, 'component_name' => $component ? $component->name : null, 'name' => $incident->name, 'timestamp' => $incident->created_at_formatted, 'status' => $incident->human_status, 'html_content' => $incident->formattedMessage, 'text_content' => $incident->message, 'token' => $subscriber->token, 'manage_link' => route('subscribe.manage', ['code' => $subscriber->verify_code]), 'unsubscribe_link' => route('subscribe.unsubscribe', ['code' => $subscriber->verify_code])];
     $this->mailer->queue(['html' => 'emails.incidents.new-html', 'text' => 'emails.incidents.new-text'], $mail, function (Message $message) use($mail) {
         $message->to($mail['email'])->subject($mail['subject']);
     });
 }
 /**
  * Prepare and push a job onto the queue to send the e-mail with the verification token link.
  *
  * @param  \Illuminate\Contracts\Auth\Authenticatable  $user
  * @param  string  $subject
  * @param  string  $from
  * @param  string  $name
  * @return mixed
  */
 protected function emailQueueVerificationLink(AuthenticatableContract $user, $subject, $from = null, $name = null)
 {
     return $this->mailer->queue($this->emailView, compact('user'), function ($m) use($user, $subject, $from, $name) {
         if (!empty($from)) {
             $m->from($from, $name);
         }
         $m->to($user->email);
         $m->subject(is_null($subject) ? trans('laravel-user-verification::user-verification.verification_email_subject') : $subject);
         event(new VerificationEmailSent($user));
     });
 }
Пример #15
0
 /**
  * add mail to queue
  * @param $view
  * @param $data
  * @param $callback
  */
 protected function addToQueue($view, $data, $callback)
 {
     $this->mailer->queue($view, $data, $callback);
 }
Пример #16
0
 /**
  * @param $view
  * @param $data
  *
  * @return mixed
  */
 public function queue($view, $data)
 {
     return $this->mailer->queue($view, $data, $this->callback($data));
 }
Пример #17
0
 /**
  * Send a new message using the a view via queue.
  *
  * @param string|array    $view
  * @param array           $data
  * @param \Closure|string $callback
  *
  * @return void
  */
 public function queue($view, array $data, $callback)
 {
     $data = array_merge($this->settings, $data);
     $this->mailer->queue($view, $data, $callback);
 }
Пример #18
0
 /**
  * @param $user
  * @param $subject
  * @param $view
  * @param $data
  */
 public function sendTo($user, $subject, $view, $data = [])
 {
     $this->mail->queue($view, $data, function ($message) use($user, $subject) {
         $message->to($user->email)->subject($subject);
     });
 }
Пример #19
-1
 public function deliver()
 {
     $message = $this->buildMessage(['from' => $this->from, 'to' => $this->to, 'subject' => $this->subject, 'attachments' => $this->attachments]);
     if (!empty($this->queue)) {
         if (!empty($this->queueName)) {
             return $this->mailer->queue($this->queueName, $this->view, $this->data, $message);
         }
         return $this->mailer->queue($this->view, $this->data, $message);
     }
     if (!empty($this->later)) {
         if (!empty($this->queueName)) {
             return $this->mailer->laterOn($this->queueName, $this->later, $this->view, $this->data, $message);
         }
         return $this->mailer->later($this->later, $this->view, $this->data, $message);
     }
     return $this->mailer->send($this->view, $this->data, $message);
 }