/** * Prepare and push a job onto the given queue to send the e-mail with the verification token link. * * @param string $queue * @param \Illuminate\Contracts\Auth\Authenticatable $user * @param string $subject * @param string $from * @param string $name * @return mixed */ protected function emailQueueOnVerificationLink($queue, AuthenticatableContract $user, $subject, $from = null, $name = null) { return $this->mailer->queueOn($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)); }); }
/** * send email * * @param bool $queue * @return bool */ public final function send($queue = true) { //php cannot 'use' this variables yet $name = $this->name; $email = $this->email; $subject = $this->subject; $attachments = $this->attachments; //data $data = array_merge($this->defaultData, $this->data); //queue email if ($queue) { $this->mailer->queueOn('email', $this->view, $data, function ($message) use($name, $email, $subject, $attachments) { //set recipient $message->to($email, $name); //set subject $message->subject($subject); //set attachments foreach ($attachments as $attachment) { $message->attach($attachment); } }); } else { $this->mailer->send($this->view, $data, function ($message) use($name, $email, $subject, $attachments) { //set recipient $message->to($email, $name); //set subject $message->subject($subject); //set attachments foreach ($attachments as $attachment) { $message->attach($attachment); } }); } //make sure to clear out recipient info, so we don't accidentally send multiple times to same person $this->name = null; $this->email = null; }
/** * @param $queue * @param $view * @param $data * * @return mixed */ public function queueOn($queue, $view, $data) { return $this->mailer->queueOn($queue, $view, $data, $this->callback($data)); }