How to Set Subject In Laravel Mail ?

Share Me
  •  
  •  
  •  
  • 1
  •  
  •  
  •  
  •  
  •  
  •  
  •  
    1
    Share
How to Set Subject In Laravel Mail

Hi Dev’s, Today now in this tutorial,I will show you how to set subject send email by using markdown mailable class in our laravel application. So we can simply set the subject in laravel mail.

Click to Mailable class Example

Link: How to Send Mail by using Mailable Class in Laravel 8?

Solution

you can set build() method in mailable class example.

app/Mail/MyTestMail.php

/**
 * Build the message.
 *
 * @return $this
 */
public function build()
{
    return $this->subject('Your Subject')
                ->markdown('emails.myDemo')
                ->attach(public_path('pdf'), [
                    'as' => 'sample.pdf',
                    'mime' => 'application/pdf',
                ]);
}

Read Also : How to Send Email with Attachment in Laravel 8?

Thanks for read. I hope it help you. For more you can follow us on facebook.

About code chef

My name is Shahriar sagor. I'm a developer. I live in Bangladesh and I love to write tutorials and tips that will help to other Developer's. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.

View all posts by code chef →