laravel-5

Change some text in reset password mail in laravel 5.4


I have used default authentication by using the artisan comment

php artisan make:auth

It has forgot password button to reset user password. It's working fine but I need to change some of the text in Password reset mail. For example the Hello text and Regards text.

By using the comment php artisan make:notification MyResetPassword I can override the existing mail template but to change only two text I don't want to do that much changes.

There is a file to change some mail body lines in ResetPassword.php in toMail method. I need to know how can I change Hello and Regards text by using this method (toMail()).

I have changed my mail subject line like below.

public function toMail($notifiable)
{
    return (new MailMessage)
        ->subject('Company of Good Portal Dashboard - Reset Password')
        ->line('You are receiving this email because we received a password reset for your COG Portal – CMS account.')
        ->action('Reset Password', url(config('app.url').route('password.reset', $this->token, false)))
        ->line('If you did not request a password reset, no further action is required.');
}

How can I proceed?


Solution

  • Try this

    public function toMail($notifiable)
        {
            return (new MailMessage)
                ->subject('Aplikasi Peminjaman Cimahi Techno Park - Reset Password')
                ->greeting('Hello')
                ->line('Anda menerima email ini karena kami menerima permintaan reset password untuk akun anda.')
                ->action('Reset Password', url(config('app.url').route('password.reset', $this->token, false)))
                ->line('Jika anda tidak mengirimkan permintaan untuk reset password, abaikan email ini.')
                ->salutation('Terima Kasih,')
                ->salutation('Cimahi Techno Park');
        }