Laravel-在降价邮件中使用@foreach [英] Laravel- use @foreach in markdown mail

查看:74
本文介绍了Laravel-在降价邮件中使用@foreach的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在markdown模板中使用@foreach循环发送邮件.

I am trying to use @foreach loop inside markdown template for sending mails.

虽然在@foreach中使用HTML标记,但无法正确呈现

While using HTML tags inside @foreach, it is not rendered properly

@component('mail::message')

These are the latest contents in our website

@foreach($results as $type => $result)
   <h4>{{ $result['name'] }}</h4>
@endforeach

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

在收到的邮件中,<h4>标签将显示为

In the received mail, the <h4> tag will be displayed as,

<h4>Article</h4>

将Markdown放入@foreach循环中时未得到处理.但是,将其放置在@foreach循环之外时会对其进行处理.

Markdown is not getting processed when it's placed inside @foreach loop. But it's processed when placed outside @foreach loop.

任何帮助将不胜感激.谢谢.

Any help will be much appreciated. Thanks.

推荐答案

编写Markdown电子邮件时,请勿使用多余的缩进.降价促销 解析器会将缩进的内容呈现为代码块.

Do not use excess indentation when writing Markdown emails. Markdown parsers will render indented content as code blocks.

问题不是放在@foreach内的HTML标记,而是缩进使解析器呈现如下(我现在使用markdown,在<h4>之前的4个空格):

The problem is not the HTML tags put inside the @foreach, but the indentation makes parsers render as follows (I am using markdown now, 4 spaces before <h4>):

<h4>Article</h4>

这篇关于Laravel-在降价邮件中使用@foreach的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆