Reputation: 1813
I'm quite new to Laravel, but have recently taken over a project from someone and trying to get the mail blade templates to render but I am having problems.
The code used for the enquiry email template is as follows:
@component('mail::message')
#New customer enquiry
We have received a new customer enquiry.
@component('mail::table')
| **Name** | **Email** | **Telephone** |
| ---------------------------------------------- |:---------------------:| -----------------------:|
| {{$enquiry->firstname}} {{$enquiry->lastname}} | <{{$enquiry->email}}> | {{$enquiry->telephone}} |
@endcomponent
Thanks,<br>
{{ config('app.name') }}
@endcomponent
But the table always renders as raw HTML, here is a screenshot of how the email looks in MailCatcher:
I've checked a couple of other posts that concern this kind of issue but usually it's due to the attempt to render more than one table in a mail template, but this is just a single table. Is there a component I have missed or is it just MailCatcher not rendering correctly?
Upvotes: 2
Views: 4798
Reputation: 579
When using Markdown to render emails, avoid using indents excessively. Your code should look like this
@component('mail::message')
#New customer enquiry
We have received a new customer enquiry.
@component('mail::table')
| **Name** | **Email** | **Telephone** |
| ---------------------------------------------- |:---------------------:| -----------------------:|
| {{$enquiry->firstname}} {{$enquiry->lastname}} | <{{$enquiry->email}}> | {{$enquiry->telephone}} |
@endcomponent
Thanks,<br>
{{ config('app.name') }}
@endcomponent
Upvotes: 14
Reputation: 443
You didn't show how the html which is not being rendered is being loaded.
But it's possible you need to use {!! !!}
instead of {{ }}
for the variables that contain html.
Upvotes: 0