Laravel不作为HTML处理视图

发布于 2025-02-13 23:37:10 字数 730 浏览 0 评论 0原文

我有一个Laravel应用程序,我想发送电子邮件。它在我的应用程序中工作,我可以收到电子邮件,但是我收到的电子邮件看起来像:

@component('mail::message') # Final step... Confirm your email address to complete your Twitter account {{ $user->username }}. It's easy — just click the button below. @component('mail::button', ['url' => $company->activation_code]) Confirm now @endcomponent Thanks, {{ config('app.name') }} @endcomponent

Laravel甚至不会转换组件或变量。它像字符串一样发送视图。

发送电子邮件的代码是:

Mail::to($company->email)->send(new CompanyActivation($company));

公司激活中的代码是:

return $this->subject('Account activatie')->markdown('emails.companyactivation');

我如何告诉Laravel处理视图并将其发送为HTML

I have a Laravel application and I want to send email. It works in my application and I can receive emails however the emails I receive look like this:

@component('mail::message') # Final step... Confirm your email address to complete your Twitter account {{ $user->username }}. It's easy — just click the button below. @component('mail::button', ['url' => $company->activation_code]) Confirm now @endcomponent Thanks, {{ config('app.name') }} @endcomponent

Somehow Laravel isnt even converting the components nor the variables. It is sending the view like a string.

The code to send an email is this:

Mail::to($company->email)->send(new CompanyActivation($company));

and the code in CompanyActivation is:

return $this->subject('Account activatie')->markdown('emails.companyactivation');

How can I tell Laravel to process the view and send it as html

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

小清晰的声音 2025-02-20 23:37:10

我找到了解决方案。我通过手动创建电子邮件刀片文件启动文件。然后,我使用PHP工匠命令启动了一个新的电子邮件模板。我将内容粘贴在新创建的文件中,现在一切正常。

I found the solution. I started the file by manually creating the email blade file. I then started a new email template using the php artisan command. I pasted the content in the newly created file and everything works now.

倾听心声的旋律 2025-02-20 23:37:10

确保所有凹痕和空间都是正确的。

使用降价空间或错误的凹痕时,将调用一个代码块。

尝试:

@component('mail::message') 

# Final step...

Confirm your email address to complete your Twitter account {{ $user->username }}. It is easy — just click the button below.

@component('mail::button', ['url' => $company->activation_code])

Confirm now

@endcomponent

Thanks, {{ config('app.name') }} 

@endcomponent

而不是:

@component('mail::message') # Final step... Confirm your email address to complete your Twitter account {{ $user->username }}. It's easy — just click the button below. @component('mail::button', ['url' => $company->activation_code]) Confirm now @endcomponent Thanks, {{ config('app.name') }} @endcomponent

Make sure that all indents and spaces are correct.

When using markdown spaces or wrong indents will invoke a code block.

Try:

@component('mail::message') 

# Final step...

Confirm your email address to complete your Twitter account {{ $user->username }}. It is easy — just click the button below.

@component('mail::button', ['url' => $company->activation_code])

Confirm now

@endcomponent

Thanks, {{ config('app.name') }} 

@endcomponent

Instead of:

@component('mail::message') # Final step... Confirm your email address to complete your Twitter account {{ $user->username }}. It's easy — just click the button below. @component('mail::button', ['url' => $company->activation_code]) Confirm now @endcomponent Thanks, {{ config('app.name') }} @endcomponent
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文