Laravel不作为HTML处理视图
我有一个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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我找到了解决方案。我通过手动创建电子邮件刀片文件启动文件。然后,我使用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.
确保所有凹痕和空间都是正确的。
使用降价空间或错误的凹痕时,将调用一个代码块。
尝试:
而不是:
Make sure that all indents and spaces are correct.
When using markdown spaces or wrong indents will invoke a code block.
Try:
Instead of: