Framework: Emails showing raw HTML after upgrade to 6.10

Created on 16 Jan 2020  路  6Comments  路  Source: laravel/framework

  • Laravel Version: 6.11
  • PHP Version: 7.3
  • Database Driver & Version: -

Description:

After 6.10 upgrade, all of my emails are broked because the HTML inside mail::panel component is now inside a <pre> tag and shows the raw HTML for user.

I have published all vendor assets of emails and I tried to remove indentation (like the Taylor's commit), and no results.

I needed to rollback Laravel to version 6.9. I think if is this the right behaviour, it should be documented in release upgrade guide because it is a broke change.

There is a definitive fix for this problem?

needs more info

All 6 comments

Share your entire Markdown email file.

emails/layouts/main.blade.php // All extends this

@component('mail::message', ['unsubscribeUrl' => $unsubscribeUrl ?? null])

{{-- Body --}}
@yield('mail-body')

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

vendor/mail/html/message

@component('mail::layout')
    {{-- Header --}}
    @slot('header')
        @component('mail::header', ['url' => config('app.url')])
            {{ config('app.name') }}
        @endcomponent
    @endslot

    {{-- Body --}}
    {{ $slot }}

    {{-- Subcopy --}}
    @isset($subcopy)
        @slot('subcopy')
            @component('mail::subcopy')
                {{ $subcopy }}
            @endcomponent
        @endslot
    @endisset

    {{-- Footer --}}
    @slot('footer')
        @component('mail::footer', ['unsubscribeUrl' => $unsubscribeUrl ?? null])
            &copy; {{ date('Y') }} {{ config('app.name') }}. All rights reserved.
        @endcomponent
    @endslot
@endcomponent

Sample broken email

@extends('emails.layouts.main')

@section('mail-body')
    Hello!
   @component('mail::panel')
        <b>{{ e(number_format($product->quantity, 2, ',', '.')) }} - {{ e($product->unit->name) }}</b><br />
    @endcomponent
@endsection

De-indent everything. Try adding an extra line break after your panel @endcomponent.

Also add a line break after your "Hello!"

@taylorotwell Removing the indentation from all files involved in the email, it works, but we have dozens of different emails. It would be a full day job to ajust and test they.

Searching about this problem, I found a solution developed by @MarekGogol: https://github.com/MarekGogol/framework/commit/5d0b1d5e75542821bc6fcfe72eaefde0dc303e24

Any chance to apply on 6.x?

That PR won't solve every case. Markdown considers indented stuff to be code blocks. So, we just have to de-indent everything. Sorry for the inconvenience.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fideloper picture fideloper  路  3Comments

gabriellimo picture gabriellimo  路  3Comments

klimentLambevski picture klimentLambevski  路  3Comments

felixsanz picture felixsanz  路  3Comments

lzp819739483 picture lzp819739483  路  3Comments