This is the problem:
I need help for this one. Thanks
Send Email Notifications in Laravel php use App\Notifications\Newvisit; Route::get('/', function () { $user = App\User::first(); $user->notify(new Newvisit("A new user has visited on your application.")); return view('welcome'); });
From what I understand, Mailables are used to send only emails whereas Notifications can be used to send emails and sms.
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');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With