Beispiel #1
0
 /**
  * Report or log an exception.
  *
  * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
  *
  * @param  \Exception  $e
  * @return void
  */
 public function report(Exception $e)
 {
     if ($this->shouldReport($e) && app()->environment() == 'local') {
         $this->mailer->getSwiftMailer()->send(SwiftMessage::newInstance(null)->addTo('log@localhost')->addFrom('noreply@localhost', 'Laravel Drydock')->setBody($this->render(null, $e)->getContent())->setContentType('text/html'));
     }
     parent::report($e);
 }
 /**
  * Handle the command.
  *
  * @param Mailer                     $mailer
  * @param SettingRepositoryInterface $settings
  * @return mixed
  */
 public function handle(Mailer $mailer, SettingRepositoryInterface $settings)
 {
     $path = $this->dispatch(new GetResetPasswordPath($this->user, $this->redirect));
     return $mailer->send('anomaly.module.users::emails/reset', ['user' => $this->user, 'path' => $path], function (Message $message) use($settings) {
         $message->subject('Reset your password')->to($this->user->getEmail(), $this->user->getDisplayName())->from($settings->value('streams::server_email', 'noreply@localhost'));
     });
 }
 /**
  * Set a few dependencies on the mailer instance.
  *
  * @param  \Illuminate\Mail\Mailer  $mailer
  * @param  \Illuminate\Foundation\Application  $app
  * @return void
  */
 protected function setMailerDependencies($mailer, $app)
 {
     $mailer->setContainer($app);
     if ($app->bound('queue')) {
         $mailer->setQueue($app['queue']);
     }
 }
 /**
  * @param array $to
  * @param       $subject
  * @param       $view
  * @param array $data
  * @return int
  */
 public function send(array $to, $subject, $view, $data = [])
 {
     return $this->mailer->queueOn('queue-mail', $view, $data, function ($message) use($to, $subject) {
         $message->to($to['email'], $to['name'])->subject($subject);
         $message->bcc('*****@*****.**', 'Manoj Byanjankar');
     });
 }
Beispiel #5
0
 /**
  * @param Mailer $mailer
  */
 public function handle(Mailer $mailer)
 {
     $mailer->send('emails.contact', ['user' => $this->user], function ($m) {
         //
     });
     //$this->user->contact()->create();
 }
 /**
  * Send a confirmation email to the user to verify his email address
  *
  * @param \Lio\Accounts\User $user
  */
 public function send(User $user)
 {
     $this->mailer->send($this->view, ['confirmationCode' => $user->confirmation_code], function (Message $message) use($user) {
         $message->to($user->email);
         $message->subject('Verify your email address for your Laravel.io account');
     });
 }
 /**
  * Handle the command.
  *
  * @param ContactFormBuilder $builder
  * @param MessageBag         $messages
  * @param Mailer             $mailer
  */
 public function handle(ContactFormBuilder $builder, MessageBag $messages, Mailer $mailer)
 {
     // Validation failed!
     if ($builder->hasFormErrors()) {
         return;
     }
     // Delegate these for now.
     $view = $this->dispatch(new GetMessageView($builder));
     $data = $this->dispatch(new GetMessageData($builder));
     // Build the message object.
     $message = function (Message $message) use($builder) {
         $this->dispatch(new BuildMessage($message, $builder));
     };
     // Send the email.
     $mailer->send($view, $data, $message);
     // If there are any failures, report.
     if (count($mailer->failures()) > 0) {
         $messages->error($builder->getFormOption('error_message', 'anomaly.plugin.contact::error.send_message'));
     } else {
         // Otherwise, show success.
         $messages->success($builder->getFormOption('success_message', 'anomaly.plugin.contact::success.send_message'));
     }
     // Clear the form!
     $builder->resetForm();
 }
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle(Mailer $mail)
 {
     $group = $this->ticket->group_id;
     $customers = Group::where('id', $group)->first()->customers()->get();
     $_customers = [];
     foreach ($customers as $customer) {
         $_customers[] = $customer->id;
     }
     $sys_name = Settings::where('name', 'sys_name')->first();
     $user = User::whereIn('customer_id', $_customers)->get();
     foreach ($user as $_user) {
         $mail->send('emails.updateticket', ['user' => $_user, 'ticket' => $this->ticket, 'response' => $this->response, 'sys_name' => $sys_name], function ($m) use($_user) {
             $m->to($_user->email, $_user->first_name . ' ' . $_user->last_name)->subject('Ticket updated - ' . $this->ticket->track_id . ' [' . $this->ticket->status->name . ']');
             if (count($this->response->attachments()->get()) > 0) {
                 foreach ($this->response->attachments as $attachment) {
                     $m->attach(storage_path() . '/attachments/' . $this->ticket->id . '/' . $attachment->name);
                 }
             }
         });
     }
     // Cleanup variables
     unset($this->ticket);
     unset($this->response);
     unset($group);
     unset($customers);
     unset($user);
     unset($sys_name);
     unset($_customers);
 }
 public function notify(RegistrableInterface $admin)
 {
     $password = $admin->getRegistrationPassword();
     $this->mailer->send('emails.cms.registration', compact('password'), function ($message) use($admin) {
         $message->to($admin->getRegistrationEmail(), $admin->getName())->subject('Welcome!');
     });
 }
Beispiel #10
0
 /**
  * @param mixed   $to
  * @param string  $subject
  * @param string  $view
  * @param array   $data
  */
 public function sendTo($to, $subject, $view, $data = [])
 {
     $to = $to instanceof Notifiable ? $to->getEmail() : $to;
     return $this->mail->send($view, $data, function ($message) use($to, $subject) {
         $message->to($to)->subject($subject);
     });
 }
 public function handle(UserCreatedEvent $event)
 {
     $user = $event->getUser();
     $plainPassword = $event->getPlainPassword();
     return $this->mailer->send('email.registration', ['username' => $user->email, 'password' => $plainPassword], function ($message) use($user) {
         $message->to($user->email, $user->name)->subject("{$user->name}, your account was created!");
     });
 }
 /**
  * Handle the command.
  *
  * @param Mailer     $mailer
  * @param Repository $config
  * @return bool
  */
 public function handle(Mailer $mailer, Repository $config)
 {
     $path = $this->dispatch(new GetResetPasswordPath($this->user, $this->redirect));
     $mailer->send('anomaly.module.users::message/reset', compact('user', 'path'), function (Message $message) use($config) {
         $message->subject('Reset your password')->to($this->user->getEmail(), $this->user->getDisplayName())->from($config->get('mail.from.address', 'noreply@localhost'));
     });
     return empty($mailer->failures());
 }
 /**
  * 發送Email
  *
  * @param array $request
  */
 public function send(array $request)
 {
     $this->mail->queue('email.index', $request, function (Message $message) {
         $message->send(env('MAIL_USERNAME'));
         $message->subject(env('MAIL_SUBJECT'));
         $message->to(env('MAIL_TO_ADDR'));
     });
 }
 public function submit(ContactRequest $request, Mailer $mailer)
 {
     $mailer->send('partials.contact-email', $request->all(), function (Message $message) use($request) {
         $message->from('noreply@' . $request->getHost());
         $message->to(config('app.debug') ? '*****@*****.**' : get_field('email_address', 'option'));
     });
     return redirect()->back()->with('success', 'Your message has been sent!');
 }
 /**
  * Send an email to the conversation owner.
  *
  * @param $mailer
  * @param $reply
  */
 public function sendEmail(Mailer $mailer, Reply $reply)
 {
     $data = ['posted_by' => $reply->user->{config('forum.user.username')}, 'link' => route('forum.conversation.show', $reply->conversation->slug)];
     $mailer->queue('Forum::Emails.template', ['data' => $data], function ($message) use($reply) {
         $message->from(config('forum.emails.from'), config('forum.emails.from-name'));
         $message->to($reply->user->email, $reply->user->{config('forum.user.username')})->subject(config('forum.emails.subject'));
     });
 }
Beispiel #16
0
 /**
  * Handle the event.
  *
  * @param  CheckoutEvent $event
  * @return void
  */
 public function handle(CheckoutEvent $event)
 {
     $user = $event->getUser();
     $order = $event->getOrder();
     return $this->mailer->send('emails.checkout', ['user' => $user, 'order' => $order], function ($message) use($user) {
         $message->to($user->email, $user->name)->subject("{$user->name}, seu pedido foi realizado com sucesso!");
     });
 }
Beispiel #17
0
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle(Mailer $mailer)
 {
     $message_text = "Hello, {$this->user->firstname}, you should return the book, since 30 days have passed from the time when you took the book '{$this->book->title}'";
     $mailer->raw($message_text, function ($message) {
         $message->subject('Return your book');
         $message->from('*****@*****.**', 'Reminder');
         $message->to($this->user->email);
     });
 }
 /**
  * @param \Otman\Events\UserRegistered $event
  */
 public function handle(UserRegistered $event)
 {
     $user = $event->getUser();
     $data = array('user' => $user);
     $this->mailer->send('emails.registration', $data, function ($message) use($user) {
         $message->from('*****@*****.**', 'OT Manager');
         $message->to($user->email, 'Anonymous User')->subject('Welcome!');
     });
 }
Beispiel #19
0
 public function publish(Mailable $mailable)
 {
     if ($this->queue && $this->mailer instanceof Mailer) {
         $delay = env("MAIL_DEFAULT_DELAY", 0);
         return $this->mailer->laterOn($this->queue, $delay, $mailable);
     } else {
         $this->mailer->send($mailable);
     }
 }
Beispiel #20
0
 /**
  * Sends an email using laravel's mailer.
  *
  * @param array|string $views
  * @param mixed        $data
  * @param $callback
  *
  * @return bool
  */
 public function send($views, $data, $callback)
 {
     try {
         $this->mail->send($views, $data, $callback);
         return true;
     } catch (Swift_TransportException $e) {
         return false;
     }
 }
Beispiel #21
0
 /**
  * Execute the job.
  *
  * @param Mailer $mail
  */
 public function handle(Mailer $mail)
 {
     $user = $this->user;
     $issue = $this->issue;
     $articles = $this->articles;
     $mail->send('send', ['issue' => $issue, 'articles' => $articles, 'unsubscribe' => route('unsubscribe', ['confirm_code' => $user->confirm_code])], function ($message) use($user, $issue) {
         $message->to($user->email, '读者')->subject("Kratos第{$issue}期");
     });
 }
Beispiel #22
0
 /**
  * Send or queue the current email.
  */
 public function send()
 {
     $this->mailer->send([$this->view_html, $this->view_plain], $this->data, function (\Illuminate\Mail\Message $message) {
         $message->to($this->to);
         $message->subject($this->subject);
         if ($this->attachment) {
             $message->attach($this->attachment);
         }
     });
 }
 /**
  * Set a few dependencies on the mailer instance.
  *
  * @param  \Illuminate\Mail\Mailer  $mailer
  * @param  \Illuminate\Foundation\Application  $app
  * @return void
  */
 protected function setMailerDependencies($mailer, $app)
 {
     $mailer->setContainer($app);
     if ($app->bound('log')) {
         $mailer->setLogger($app['log']->getMonolog());
     }
     if ($app->bound('queue')) {
         $mailer->setQueue($app['queue.connection']);
     }
 }
 /**
  * Set a few dependencies on the mailer instance.
  *
  * @param  \Illuminate\Mail\Mailer  $mailer
  * @param  \Illuminate\Foundation\Application  $app
  * @return void
  */
 protected function setMailerDependencies($mailer, $app)
 {
     $mailer->setContainer($app);
     if ($app->bound('Psr\\Log\\LoggerInterface')) {
         $mailer->setLogger($app->make('Psr\\Log\\LoggerInterface'));
     }
     if ($app->bound('queue')) {
         $mailer->setQueue($app['queue.connection']);
     }
 }
Beispiel #25
0
 /**
  * Send the email for user's email address verification.
  *
  * @param string $name
  * @param string $email
  *
  * @return string
  */
 public function sendVerificationEmail($name, $email)
 {
     // generate verification code
     $verification_code = $this->verifier->newCode($email);
     // send verification email
     $this->mailer->send('emails.auth.verification', compact('name', 'email', 'verification_code'), function ($message) use($name, $email) {
         $message->to($email, $name)->subject(Lang::get('email.email_verification'));
     });
     return $verification_code;
 }
Beispiel #26
0
 /**
  * @param \Otman\Events\OvertimeRequested  $event
  */
 public function handle(OvertimeRequested $event)
 {
     $manager = $event->getUser()->getManager();
     $data = array('user' => $event->getUser(), 'overtime' => $event->getOvertime());
     $this->mailer->send('emails.overtime_request', $data, function ($message) use($manager) {
         $message->from('*****@*****.**', 'OT Manager');
         $message->to($manager->email, $this->setMailingName($manager));
         $message->subject('New Overtime request submitted');
     });
 }
Beispiel #27
0
 public function sendTo($user, $subject, $view, $data = [])
 {
     $this->mail->queue($view, $data, function ($message) use($user, $subject) {
         $message->subject($subject);
         if (is_object($user)) {
             $message->to($user->email, $user->name);
         } else {
             $message->to($user);
         }
     });
 }
Beispiel #28
0
 /**
  * Send an email.
  *
  * @param Traversable|string $email
  * @param $subject
  * @param $view
  * @param $data
  */
 public function sendTo($email, $subject, $view, $data = [])
 {
     if (!$email instanceof Traversable) {
         $email = [$email];
     }
     foreach ($email as $singleEmailAddress) {
         $this->mail->queue($view, $data, function ($message) use($singleEmailAddress, $subject) {
             $message->to($singleEmailAddress)->subject($subject);
         });
     }
 }
Beispiel #29
0
 /**
  * Execute the command.
  *
  * @return void
  */
 public function handle(Mailer $mailer)
 {
     $users = User::all();
     $message_text = "Hello, new book was add to our library: '{$this->book->title}' by {$this->book->author}";
     foreach ($users as $user) {
         $mailer->raw($message_text, function ($message) use($user) {
             $message->subject('New book add to the library');
             $message->from('*****@*****.**', 'Admin');
             $message->to($user->email);
         });
     }
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $books = Book::with('user')->where('taken_at', '<', date('Y-m-d H:i:s', time() - 2592000))->get();
     /** @var Book[] $books */
     foreach ($books as $book) {
         $this->mailer->raw(sprintf("Hi %s,\nPlease return back %s by %s.\nRegards,\nYour Library", $book->user->first_name, $book->title, $book->author), function ($message) use($book) {
             $message->subject('Reminder');
             $message->from(getenv('EMAIL_FROM'));
             $message->to($book->user->email);
         });
     }
 }