Article
Customize email verification in Laravel 8
How to customize email verification in Laravel 8 ? I explain everything !
In most applications, when we register, we use our email address and receive a confirmation email to check the address is ours.
Email verification is so used that it is featured by design in Laravel.
It uses the framework translation's system and is then very easy to translate into other languages.
The laravel-lang/lang package gives already made files, letting us use it directly into our project when needed.
It works very well to translate the content, but how can we truly modify the content, for example to add lines or a second button?
This time, it's not a view to publish as usual.
To change the notification, Laravel offers to register a toMailUsing
callback into your AuthServiceProvider
VerifyEmail::toMailUsing(function ($notifiable, $url) {
return (new MailMessage())
->subject(__('Verify Email Address'))
->line(__('Click the button below to verify your email address.'))
->line(__('You must be logged in to verify your email address.'))
->action(__('Verify Email Address'), $url);
});