Reset Password Email
I am new to laravel development and am currently working on a small project. I would like to customize the password reset email template, or even link it to a completely different template. For authentication systems, I used php artisan make: auth command .
However, the default reset password function uses the default laravel template template. Is it possible that I can create a different email template and link it to reset Password Controller? Also I would like to convey additional information about the user.
I am using laravel 5.4 version.
source to share
You can create a notification class with:
php artisan make:notification ResetPassword
You can override the method toMail()
to customize the theme and string.
public function toMail($notifiable)
{
return (new MailMessage)
->subject('Reset Password Request')
->line('You are receiving this email because we received a password reset request for your account.')
->action('Reset Password', url('password/reset', $this->token))
->line('If you did not request a password reset, no further action is required.');
}
And in the model users
:
use Illuminate\Notifications\Notifiable;
use App\Notifications\ResetPassword as ResetPasswordNotification;
public function sendPasswordResetNotification($token)
{
$this->notify(new ResetPasswordNotification($token));
}
And customize the whole email template. here is the view:resources/views/notification/email.blade.php;
And in config/app.php
, you can change the name of the application, the default is laravel.
source to share