Recently, I was looking for a simple way to customise the subject and email content of password reset email notification that is included with Laravel. A quick Internet search yielded a few result, but most of them recommend overriding sendPasswordResetNotification method and use your own Notification class.

In fact, this is also the method recommended in the official Laravel documentation.

However, there’s an easier way; by extending the default Illuminate\Auth\Notifications\PasswordReset via the toMailUsing method, similar to what is recommended to customise the verification email as mentioned in the documentation.

In your AppServiceProvider, you can do:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

use Illuminate\Auth\Notifications\PasswordReset;
use Illuminate\Notifications\Messages\MailMessage;
 
/**
 * Bootstrap any application services.
 */
public function boot(): void
{
    // ...
 
    PasswordReset::toMailUsing(function (object $notifiable, string $token) {
        $url = url(route('password.reset', [
            'token' => $token,
            'email' => $notifiable->getEmailForPasswordReset(),
        ], false));
        
        return (new MailMessage)
            ->subject('Reset your password')
            ->line('Click the button below to reset your password.')
            ->action('Reset Password', $url);
    });
}

Please note that the second parameter of the callback is the token, so you will need to generate the password reset link yourself. In the example above, I have copied the original implementation that is also available in the PasswordReset class.