/** * 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'); }); }
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!'); }); }
/** * @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); }); }
/** * 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!"); }); }
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!"); }); }
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); } }
/** * @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!'); }); }
/** * 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; } }
/** * 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); } }); }
/** * @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'); }); }
/** * 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; }
/** * Execute the job. * * @return void */ public function handle(Mailer $mailer) { foreach ($this->recipients as $recipient) { $mailer->send('emails.reports.efficiency_report', ['logs' => $this->logs], function ($message) use($recipient) { $message->from('*****@*****.**', 'Production @ MTech SA')->to($recipient->email, $recipient->name)->subject(Carbon::now()->format('j M Y A') . ' Efficiency Report'); }); } // Email production admin $mailer->send('emails.reports.efficiency_report', ['logs' => $this->logs], function ($message) { $message->from('*****@*****.**', 'Production @ MTech SA')->to('*****@*****.**', 'Production Management')->subject(Carbon::now()->format('j M Y A') . ' Efficiency Report'); }); }
/** * Handle the event. * * @param Created $event * * @return void */ public function handle(Created $event) { $users = $this->user->whereIsAdministrator()->get(); foreach ($users as $user) { // Only notify users who don't own the ticket. if ($event->issue->user->id != $user->id) { $this->mailer->send('emails.issues.new', compact('event'), function ($m) use($event, $user) { $m->to($user->email); $m->subject("New Ticket: {$event->issue->title}"); }); } } }
/** * 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); }
/** * Send a new message using a view. * * @param string|array $view * @param array $data * @param \Closure|string $callback * @return mixed */ public function send($view, array $data, $callback) { if ($this->autoResetEnabled()) { $this->resetSwiftTransport(); } return $this->mailer->send($view, $data, $callback); }
/** * 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')); }); }
/** * @param Mailer $mailer */ public function handle(Mailer $mailer) { $mailer->send('emails.contact', ['user' => $this->user], function ($m) { // }); //$this->user->contact()->create(); }
/** * Send the email. * * @param null $callback * @return $this * * @author Cali */ public function send($callback = null) { if (!!site('smtpEmailOn')) { $this->mailer->send($this->content(), $this->messageData(), is_null($callback) ? $this->messageBuilder() : $callback); } return $this; }
/** * 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(); }
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!'); }
/** * 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()); }
/** * {@inheritdoc} * * @param string $view The (blade) template name * @param array $data The view vars * @param callable $callback (optional) A closure to modify the mail before send **/ public function send($view, array $data, $callback = null) { $recipients = $this->finalRecipients($this->flushRecipients($callback)); $view = $this->finalView($view); $data = $this->parseTexts($this->finalData($data)); $messageBuilder = $this->createBuilder($recipients, $data, $callback); return $this->laravelMailer->send($view, $data, $messageBuilder->builder()); }
/** * 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}期"); }); }
/** * @param array|string $view * @param array $data * @param \Closure|string $callback * @throws \Exception */ public function send($view, array $data, $callback) { $this->validateData($data); $data = array_merge($data, ['theme' => $this->theme, 'theme_template' => $this->resolveThemeTemplate()]); $previousRootUrl = $this->setRootUrl($data['root_url']); //let's wrap our closure to automatically to set email defaults. //when we passed a string, our callback represents the subject line if (is_string($callback)) { $callback = $this->stringClosure($data, $callback); } else { //if we don't have a subject, but a closure, we'll be wrapping it again //and call the closure itself at the bottom of our wrapping closure. //this allows us to override it in the originally passed closure. $this->closureClosure($data, $callback); } $result = $this->mailer->send($view, $data, $callback); $this->setRootUrl($previousRootUrl); return $result; }
/** * Handle the event. * * @param UpdateAvailable $event */ public function handle(UpdateAvailable $event) { if (config('self-update.log_events')) { $this->logger->addInfo('[' . $event->getEventName() . '] event: Notification triggered.'); } $sendToAddress = config('self-update.mail_to.address'); $sendToName = config('self-update.mail_to.name'); $subject = config('self-update.mail_to.subject_update_available'); if (empty($sendToAddress)) { $this->logger->addCritical('[' . $event->getEventName() . '] event: ' . 'Missing recipient email address. Please set SELF_UPDATER_MAILTO_ADDRESS in your .env file.'); } if (empty($sendToName)) { $this->logger->addWarning('[' . $event->getEventName() . '] event: ' . 'Missing recipient email name. Please set SELF_UPDATER_MAILTO_NAME in your .env file.'); } $this->mailer->send('vendor.self-update.mails.update-available', ['newVersion' => $event->getVersionAvailable()], function ($m) use($subject, $sendToAddress, $sendToName) { $m->subject($subject); $m->from(config('mail.from.address'), config('mail.from.name')); $m->to($sendToAddress, $sendToName); }); }
/** * Send the password reminder e-mail. * * @param \Illuminate\Auth\Reminders\RemindableInterface $user * @param string $token * @param Closure $callback * @return void */ public function sendReminder(RemindableInterface $user, $token, Closure $callback = null) { // We will use the reminder view that was given to the broker to display the // password reminder e-mail. We'll pass a "token" variable into the views // so that it may be displayed for an user to click for password reset. $view = $this->reminderView; return $this->mailer->send($view, compact('token', 'user'), function ($m) use($user, $callback) { $m->to($user->getReminderEmail()); if (!is_null($callback)) { call_user_func($callback, $m, $user); } }); }
/** * @param $request * * @return bool */ private function sendBaytinaMail($request) { $name = $request->get('name'); $phone = $request->get('phone'); $country = $request->get('country'); $message_body = $request->get('message'); $email = $request->get('email'); $subject = $this->getSubject($request); $this->mailer->send('emails.contact.' . self::TEMPLATE_BAYTINA, compact('name', 'phone', 'country', 'message_body', 'email'), function ($msg) use($subject) { $msg->to($this->email, $this->name)->subject($subject); }); return true; }
/** * Send a simple email * * For more complex emails you might write another method * * @throws MailException Throws an exception containing further information as message * @return void */ public function sendMail() { try { $this->mail->send($this->view, $this->data, function ($message) { $message->from($this->from['address'], $this->from['name']); $message->to($this->to['address'], $this->to['name'])->subject($this->subject); }); if ($this->mail->failures() != array()) { throw new MailException($this->mailErrorMessage); } } catch (Swift_TransportException $e) { $this->handleTransportExceptions($e); } }
/** * Send a new message using a view. * * @param string|array $view * @param array $data * @param \Closure|string $callback * @return mixed */ public function send($view, array $data, $callback) { /** * Split the view into it's * namespace and path. */ list($namespace, $path) = explode('::', str_replace('/', '.', $view)); /** * If the message is in the message directory * then we can assume they want to translate it. */ if (starts_with($path, 'message.')) { $locale = config('app.locale'); if (str_is('*.*.*', $path)) { list($directory, $locale, $message) = explode('.', $path); } else { list($directory, $message) = explode('.', $path); } /** * Try sending it in the current locale or the * locale specified in the data path. */ $view = "{$namespace}::{$directory}.{$locale}.{$message}"; if ($this->views->exists($view)) { return parent::send($view, $data, $callback); } /** * In the event that the locale is not available * the fallback locale must be used. */ $locale = config('app.fallback_locale'); $view = "{$namespace}::{$directory}.{$locale}.{$message}"; if ($this->views->exists($view)) { return parent::send($view, $data, $callback); } return parent::send($namespace . '::' . $path, $data, $callback); } return parent::send($view, $data, $callback); }
/** * Send a new message using a view. * * @param string|array $view * @param array $data * @param \Closure|string $callback * @return void * @static */ public static function send($view, $data, $callback) { \Illuminate\Mail\Mailer::send($view, $data, $callback); }