Set sender name via Resetpasswordnotification

Asked

Viewed 211 times

1

I am using Notification in Laravel to send password reset emails. My toMail method is like this:

public function toMail($notifiable)
{
    return (new MailMessage)
                ->subject('Link para redefinição de senha')
                ->greeting('Redefinir senha!')
                ->line('Clique no botão abaixo para redefinir sua senha.')
                ->action('Trocar senha', url('password/reset', $this->token))
                ->line('Qualquer dúvida estamos a disposição!');
}

When the email arrives in the user box, the name appears as the sender: Example. How can I set the name of my application as the sender?

1 answer

1


The configuration of the email that is responsible in sending the user the password reset, is in: app/config/mail.php, opens the file and in the configuration key from, change according to your settings:

'from' => [
    'address' => env('MAIL_FROM_ADDRESS', '[email protected]'),
    'name' => env('MAIL_FROM_NAME', 'Example'),
],

but, note that if your settings are in the file .env, then the change has to be made in that part:

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=
MAIL_FROM_NAME=

that is, it depends on how your application is configured, if you use everything in the file .env change it if it is in the configuration file only change in the mail.php. Usually the change is made in the mail.php in that particular sender setting (both e-mail, as to the name of the same).

References

Browser other questions tagged

You are not signed in. Login or sign up in order to post.