Laravel 5.4 mail messages how to edit header and footer
I already figure it out just change the name of the env file to your App name instead of laravel. This is the sample below.
APP_NAME=Laravel
Change it to
APP_NAME=YOUR_APP_NAME
there is also one way to edit your mail template. Just go to resources/views/vendor/notifications/email.blade.php and you can also edit the message to your mail just go to resources/views/vendor/markdown/message.blade.php
I want to change the header Laravel from my App name and the Hello with a Hello $user->name and the Regards, with my App name also and the footer below to the App name also
Mailable Markdown by default has the config('app.name')
that picks the APP_NAME
from your .env file. So by modifying the APP_NAME
will effect on your markdown template.
OR if you modifying it manually, run the following command on your terminalphp artisan vendor:publish --tag=laravel-mail
and go to the resources/views/vendor/mail/html/message.blade.php
and modify the header and footer slot.
For changing Hello to Hello {user_name}, there is markdown called greeting() method that holds Hello!
, you can change it whatever you want.
For Regards run this command on your terminalphp artisan vendor:publish --tag=laravel-notifications
and go to the resources/views/vendor/notifications/email.blade.php
and modify the Regards whatever you want.
To know more in details take a look on customizing markdown email.
You are using default component for your email template named @component('mail::message')
, It does not allow you to modify header. But if you go to the file of this component,
\vendor\laravel\framework\src\Illuminate\Mail\resources\views\markdown\message.blade.php
you will notice that it uses another component @component('mail::layout')
,
Just copy content of message.blade.php
file into your .blade.php
and replace {{ $slot }}
with what you had in your file before.
And you are done.