没有为[ mail ] Laravel 5.4定义提示路径

我试图在视图中显示我的降价邮件,但是在我的邮件视图中出现了一些问题

ErrorException in FileViewFinder.php line 112:
No hint path defined for [mail]. (View: /opt/lampp/htdocs/ppsb_new/core/resources/views/emails/tagihan.blade.php)

还有我的减价邮件视图

@component('mail::message')
# TAGIHAN PEMBAYARAN


Berikut tagihan anda untuk pembayaran




@component('mail::button', ['url' => ''])
wut ?
@endcomponent


Gunakan kode tagihan tersebut untuk membayar tagihan.


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

还有供应商在我的观点谁有他们的组件。

65090 次浏览

您需要在 mailable 的 build()方法中调用 markdown()方法,而不是 view()方法。请看下面的例子:

/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this->markdown('view-to-mail');
}

要使用 Markdown 可邮件,必须更新 Mailable 类的 build方法,并且必须使用 markdown()而不是 view()

像这样:

public function build()
{
return $this->markdown('emails.registered');
}

我用含咖啡因/模块的幼虫5.2。

如果你和我相似,你可以运行这个:

php artisan module:list
+------+-------+-------+-------------------------------------+----------+
| #    | Name  | Slug  | Description                         | Status   |
+------+-------+-------+-------------------------------------+----------+
| 9001 | Frame | Frame | this is a basic frame for both web. | Disabled |
| 9001 | Index | Index | this is web default index           | Enabled  |
| 9001 | Admin | Admin | This is admin of meixin project     | Enabled  |
+------+-------+-------+-------------------------------------+----------+

好的,您可以看到禁用选项。

php artisan module:enable Frame

模块已启用。

就这样,希望这能帮上忙。

如果您有一个查看没有发现与幼虫邮件的问题。尝试接受的答案后,它不工作,检查 yourtemplate.blade.php 标记文件,并确保您没有关闭 @endcomponent两次没有打开 @component

如果你有你的电子邮件查看... 视图/邮件,这就是你如何指定它:

app('view')->addNamespace('mail', resource_path('views') . '/mail');

尝试使用自定义电子邮件视图模板,如下所示:

You received a message from : \{\{ $name }}


<p>
Name: \{\{ $name }}
</p>


<p>
Email: \{\{ $email }}
</p>


<p>
Message: \{\{ $user_message }}
</p>

我有同样的问题,然后使用这种语法,并作为一个魅力


@component('mail.html.message')
# Introduction


The body of your message.


@component('mail.html.button', ['url' => config('app.url')])
Button Text
@endcomponent


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


@endcomponent


其中我的文件夹结构 views/mail/html为减记邮件。

还有我的 App\Mail\NewEmail.php

<?php


namespace App\Mail;


use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;


class NewEmail 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('mail.new-message'); // -> pointing to views/mail/new-message.blade.php containing above message
}
}


如果您想在 php 刀片文件中使用 markdown,那么可以通过 markdown ()调用 view 或者,如果您想通过 view ()调用刀片文件,请从刀片文件中删除标记语法并使用平面 html。