[英]Laravel 5.4 - Undefined variable: markdown
I am trying to send a simple email with Laravel. 我正在尝试通过Laravel发送一封简单的电子邮件。 I have no problem sending a normal HTML email but when I try to use the markdown feature I keep getting the error
发送普通的HTML电子邮件没有问题,但是当我尝试使用markdown功能时,我不断收到错误消息
Undefined variable: markdown
I am not using any instance of a model in my email right now, I am just trying to get a simple markdown email first. 我现在不在电子邮件中使用任何模型实例,我只是想首先获取一个简单的降价电子邮件。 Here is how I have everything set up.
这是我设置所有内容的方式。
Mail Controller 邮件控制器
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
class ProjectSubmitted extends Mailable
{
use Queueable, SerializesModels;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this->markdown('emails.project-submitted');
}
}
Blade Template 刀片模板
@component('mail::message')
*Lorem Ipsum Dolor
@component('mail::button', ['url' => 'http://google.com'])
Lorem Ipsum Dolor
@endcomponent
Thanks,<br>
Lorem Ipsum
@endcomponent
That is all I have right now, very basic. 这就是我现在所拥有的,非常基本。 When I try to send this email
当我尝试发送此电子邮件时
\\Mail::to('example@example.com')->send( new \\App\\Mail\\ProjectSubmitted );
I keep getting the error Undefined variable: markdown
. 我不断收到错误的
Undefined variable: markdown
。 Cannot find anything on this. 在此上找不到任何东西。 Any help would be amazing.
任何帮助都将是惊人的。
This is an issue already reported here and patched very recently here . 这已经是报告的问题在这里和修补最近这里 。
A temporary fix can be applied by editing the Mailable.php
file at the root of your project (/vendor/laravel/framework/src/Illuminate/Mail/Mailable.php). 可以通过在项目根目录(/vendor/laravel/framework/src/Illuminate/Mail/Mailable.php)中编辑
Mailable.php
文件来应用临时修复程序。
Change line 195 to 'text' => $this->buildMarkdownText($markdown, $data)
, and line 222 to protected function buildMarkdownText($markdown, $data)
. 将第195行更改为
'text' => $this->buildMarkdownText($markdown, $data)
,将第222行更改为protected function buildMarkdownText($markdown, $data)
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.