How to change From Name in Laravel Mail Notification

Masterpiece Mas Icang picture Masterpiece Mas Icang · Feb 1, 2017 · Viewed 58.4k times · Source

This is the problem:

This is the problem

I need help for this one. Thanks

Answer

Dev picture Dev · Feb 1, 2017

In config/mail.php

set from property as:

'from' => ['address' => '[email protected]', 'name' => 'Firstname Lastname']

Here, address should be the one that you want to display in from email and name should be the one what you want to display in from name.

P.S. This will be a default email setting for each email you send.

EDIT: If you need to use the Name as a variable through code, you can also call the function from() as follows (copying from Brad Ahrens answer below which I think is good to mention here):

return $this
    ->from($address = '[email protected]', $name = 'Sender name')
    ->subject('Here is my subject')
    ->view('emails.view');