PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, July 4, 2022

[FIXED] How to change From Name in Laravel Mail Notification

 July 04, 2022     email, laravel, laravel-notification     No comments   

Issue

This is the problem:

This is the problem

The name associated with the email shows up as "Example"


Solution

In config/mail.php

set from property as:

'from' => ['address' => 'someemail@example.com', '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.

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 = 'noreply@example.com', $name = 'Sender name')
    ->subject('Here is my subject')
    ->view('emails.view');


Answered By - Dev
Answer Checked By - Terry (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing