Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

meredevelopment's avatar

Confusion over how to customise mail view components

I'm attempting to customise the mail components that Laravel ships with, in particular the markdown components. I've followed the docs (5.7) as best I can, and there seems to be a bit of the puzzle missing. I'll use the docs examples to explain the scenario:

To create my mailable and the markdown template I do:

php artisan make:mail OrderShipped --markdown=emails.orders.shipped

This creates a mailable which has the build() function:

public function build()
    {
        return $this->markdown('emails.orders.shipped');
    }

It also creates a the blade view in views/emails/orders/shipped.blade.php with this in it:

@component('mail::message')
# Introduction

The body of your message.

@component('mail::button', ['url' => ''])
Button Text
@endcomponent

Thanks,<br>
{{ config('app.name') }}
@endcomponent

In that view I change "Button Text" to "Click Me". I then render the email source with this route:

use App\Mail\OrderShipped;
Route::get('/testemail', function () {
  return (new OrderShipped)->render();
});

I see the email with default styling, but the button text is changed. Brilliant.

The problem:

Now I want to customise the scaffolding of that email, the layout and colours etc. So following the docs I run php artisan vendor:publish --tag=laravel-mail and get a load of blade views generated in views/vendor/mail/html and views/vendor/mail/markdown.

As a test I want to remove the link in the header of the email. I find this template in views/vendor/mail/html/header.blade.php:

<tr>
    <td class="header">
        <a href="{{ $url }}">
            {{ $slot }}
        </a>
    </td>
</tr>

I remove the link so it looks like:

<tr>
    <td class="header">
        {{ $slot }}
    </td>
</tr>

...save the file, and re-load my rendered email. Nothing has changed. What am I doing wrong?

I can't see or deduce any more steps needed from the docs. Any help you can give will be appreciated!

0 likes
1 reply
meredevelopment's avatar
Level 3

No sooner do I post this than the answer is found under an old Github issue! It turns out my old project that's been upgraded was missing a config value.

For anyone else with weird old upgraded projects like me:

/*
    |--------------------------------------------------------------------------
    | Markdown Mail Settings
    |--------------------------------------------------------------------------
    |
    | If you are using Markdown based email rendering, you may configure your
    | theme and component paths here, allowing you to customize the design
    | of the emails. Or, you may simply stick with the Laravel defaults!
    |
    */

    'markdown' => [
        'theme' => 'default',

        'paths' => [
            resource_path('views/vendor/mail'),
        ],
    ],

needed to be in config/mail.php

sighhhhhh

2 likes

Please or to participate in this conversation.