Define sender name using ResetPasswordNotification

1

I am using Notification in Laravel to send password reset emails. My toMail method looks 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: Example appears as the sender. How can I set the name of my application as the sender?

    
asked by anonymous 02.10.2017 / 01:09

1 answer

1

The configuration of the email that is responsible for 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 .env file, 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, depending on how your application is configured, if you use everything in the file .env change in it if it is in the configuration file only change in mail.php . Usually the change is made to mail.php in that particular sender configuration (both in e-mail and in the name of the same ).

02.10.2017 / 18:05