newEmail = $newEmail; $this->token = $token; } /** * Get the notification's delivery channels. * * @param mixed $notifiable * @return array */ public function via($notifiable) { return ['mail']; } /** * Get the mail representation of the notification. * * @param mixed $notifiable * @return \Illuminate\Notifications\Messages\MailMessage */ public function toMail($notifiable) { /** @var User $notifiable */ $notifiable->email = $this->newEmail; // hack to send to the new e-mail return (new MailMessage) ->subject('E-Mail Confirmation') ->line( 'Please confirm that you just requested using this e-mail with the datatable.directory account '.$notifiable->handle.'. It will be used to login, to recover forgotten passwords, and for sending notifications. You can always opt out of e-mail notifications in the settings.') ->action('Confirm E-Mail', url(config('app.url').route('confirm-email', ['token' => $this->token], false))) ->line( 'If you did not request this action, no further action is required. The confirmation link will expire in a few hours.'); } }