laravel email – How to Change From Name in Laravel Mail?

Rate this post

laravel email uses 100% working free customisable library SwiftMailer to step b ystep code with send emails.

laravel email – Change from name

in this bellow source code to change the from email address and Change From Name dynamically using PHP Laravel.

Free Live Chat for Any Issue

how to change name in mail – Laravel?

app/Mail/SendDemoEmailExample.php

<?php
  
namespace App\Mail;
  
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
  
class SendDemoEmailExample extends Mailable
{
    use Queueable, SerializesModels;
  
    public $information_data;
  
    /**
     * Create a new message instance.
     *
     * @return void
     */
    public function __construct($information_data)
    {
        $this->information_data = $information_data;
    }
  
    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        $address = config("mail.from.address");
        $name = 'Free Download Pakainfo.com';
  
        $this->subject('Mail from pakainfo.com')
                    ->view('emails.SendDemoEmailExample')
                    ->from($address, $name);
  
        return $this;
    }
}

Don’t miss : Laravel Attachment – Laravel Send Email With Multiple Attachment Example

Download

I hope you get an idea about laravel email.
I would like to have feedback on my infinityknow.com.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.