Hello I have just started in Laravel and to manage authentication I use the fortify package, my concern is that I cannot configure the default fortify emails for example: The Verification Mail that the user receives at registration
I managed the authentication and I would like to personalize the email myself
As it is mentioned in Laravel documentation:
To get started, pass a closure to the
toMailUsing
method provided by theIlluminate\Auth\Notifications\VerifyEmail
notification. The closure will receive the notifiable model instance that is receiving the notification as well as the signed email verification URL that the user must visit to verify their email address. The closure should return an instance ofIlluminate\Notifications\Messages\MailMessage
.Typically, you should call the
toMailUsing
method from the boot method of your application'sApp\Providers\AuthServiceProvider
class.
use Illuminate\Auth\Notifications\VerifyEmail;
use Illuminate\Notifications\Messages\MailMessage;
/**
* Register any authentication / authorization services.
*/
public function boot(): void
{
// ...
VerifyEmail::toMailUsing(function (object $notifiable, string $url) {
return (new MailMessage)
->subject('Verify Email Address')
->line('Click the button below to verify your email address.')
->action('Verify Email Address', $url);
});
}
You can find the full documentation here