Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

popcone's avatar

change email verification body

How do we change email verification email body? https://laravel.com/docs/5.7/verification

0 likes
3 replies
D9705996's avatar
D9705996
Best Answer
Level 51

You can override the sendEmailVerificationNotification function from the MustVerifyEmail trait on your user model by adding you own version of this function in app\User.php

    public function sendEmailVerificationNotification()
    {
        $this->notify(new Notifications\VerifyEmail); // Replace this with your custom notification class
    }

Details on creating notifications are in the official docs

https://laravel.com/docs/5.7/notifications#creating-notifications

2 likes
Cronix's avatar

You can use a different notification class as suggested, but if you look further, you'll see that the email verification notification is just pulling the text from language files.

    public function toMail($notifiable)
    {
        if (static::$toMailCallback) {
            return call_user_func(static::$toMailCallback, $notifiable);
        }
        return (new MailMessage)
            ->subject(Lang::getFromJson('Verify Email Address'))
            ->line(Lang::getFromJson('Please click the button below to verify your email address.'))
            ->action(
                Lang::getFromJson('Verify Email Address'),
                $this->verificationUrl($notifiable)
            )
            ->line(Lang::getFromJson('If you did not create an account, no further action is required.'));
    }

So you'd just need to change the text in the language file, which you can read about here: https://laravel.com/docs/5.7/localization#using-translation-strings-as-keys

/resources/lang/en.json

{
    "Verify Email Address": "Use this subject instead",
    "Please click the button below to verify your email address.": "Other text instead",
    "If you did not create an account, no further action is required.": "Use this text for the button instead"
}
D9705996's avatar

@Cronix - the one annoying thing is that the same key is used for the subject and call to action text

Lang::getFromJson('Verify Email Address')

Therefore you can't change them independently without a custom notification

Please or to participate in this conversation.