public function register(Form $form) { $auth = Auth::customer(); $request = $form->request->all(); if (!$auth->findByEmail($request['email'])) { $auth->register($request); $user = $auth->findByEmail($request['email']); if ($user->id) { if (config('store.signup_email')) { Mail::queueOn('default', config('store.email_account_confirmation'), compact('user'), function ($message) use($user) { $message->to($user->email)->subject(trans('account.email.confirmation.subject')); }); Message::addSuccess(trans('account.alerts.instructions_sent')); } else { Message::addSuccess(trans('account.alerts.account_created')); } } else { foreach ($user->errors()->all(':message') as $error) { Message::addError($error); } } } else { Message::addError(trans('account.alerts.duplicated_credentials')); } }
/** * Handle the event. * * @param EmailChangeRequested $event */ public function handle(EmailChangeRequested $event) { $user = $event->user; $data = ['email' => $user->email, 'name' => $user->name, 'token' => $user->requestEmailToken()]; Mail::queueOn('deployer-low', 'emails.change_email', $data, function (Message $message) use($user) { $message->to($user->email, $user->name)->subject(Lang::get('emails.confirm_email')); }); }
private function sendEmail($user, $subject, $view, $data, $queue) { Mail::queueOn($queue, $view, $data, function ($message) use($user, $subject) { $message->from(Config::get('mail.from.address'), Config::get('mail.from.name')); $message->to($user->email)->subject($subject); }); Email::create(['user_id' => $user->user_id, 'subject' => $subject, 'body' => view($view)->with($data)->render(), 'status' => EmailStatus::Sent, 'sent_at' => Carbon::now()]); }
/** * Handle the event. * * @param UserWasCreated $event */ public function handle(UserWasCreated $event) { $user = $event->user; $data = ['password' => $event->password, 'email' => $user->email]; Mail::queueOn('deployer-low', 'emails.account', $data, function (Message $message) use($user) { $message->to($user->email, $user->name)->subject(Lang::get('emails.creation_subject')); }); }
/** * Execute the command. * * @return void */ public function handle() { $emails = $this->project->notifyEmails; if ($emails->count() > 0) { $status = strtolower($this->project->getPresenter()->readable_status); $subject = Lang::get('notifyEmails.subject', ['status' => $status, 'project' => $this->project->name]); $deploymentArr = $this->deployment->toArray(); $deploymentArr['commitURL'] = $this->deployment->commit_url; $deploymentArr['shortCommit'] = $this->deployment->short_commit; $data = ['project' => $this->project->toArray(), 'deployment' => $deploymentArr]; Mail::queueOn('deployer-low', 'emails.deployed', $data, function (Message $message) use($emails, $subject) { foreach ($emails as $email) { $message->to($email->email, $email->name); } $message->subject($subject); }); } }
/** * Create a new user * @return Illuminate\Support\Facades\Redirect */ public function signup() { $input = Input::all(); $v = Validator::make($input, array_merge(User::$rules, ['ign' => 'regex:/^([a-zA-Z0-9_\\-]+)$/'])); if ($v->fails()) { return Redirect::route('user.register')->withInput(Input::except('password', 'password_confirmation'))->withErrors($v); } $user = $this->repository->signup($input); if (is_null($user->id)) { return Redirect::route('user.register')->withInput(Input::except('password', 'password_confirmation'))->withErrors($user->errors()); } if (Config::get('confide::signup_email')) { Mail::queueOn(Config::get('confide::email_queue'), 'emails.user.signup', compact('user'), function ($message) use($user) { $message->to($user->email, $user->username)->subject(Lang::get('confide::confide.email.account_confirmation.subject')); }); } return Redirect::route('user.login')->with('messages', [Lang::get('confide::confide.alerts.account_created')]); }
/** * Ставим отправку почты в очередь 'subscribe' * @param $sSendTo * @param null $sTitle * @param null $sPreview * @param null $sLink */ public function mailSend($sSendTo, $sTemplate, $arData) { Mail::queueOn('subscribe', $sTemplate, $arData, function ($message) use($sSendTo) { $message->to($sSendTo); }); }