No hint path defined for [mail] Laravel 5.4
PhpLaravelEmailLaravel 5Php Problem Overview
I am trying to show my markdown email on view, but there's something wrong on my mail view, it shows like
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)
and my markdown mail view
@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
and there's also vendor on my views who have their components.
Php Solutions
Solution 1 - Php
You need to call the markdown()
method in the build()
method of your mailable - not the view()
method. See the example below:
/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this->markdown('view-to-mail');
}
Solution 2 - Php
To use Markdown mailable messages, you have to update the build
method of your Mailable class and instead of view()
, you have to use markdown()
.
Like this:
public function build()
{
return $this->markdown('emails.registered');
}
Solution 3 - Php
if you have your email views in ...views/mail, that is how you can specify it:
app('view')->addNamespace('mail', resource_path('views') . '/mail');
Solution 4 - Php
If you have a View not found issue with laravel mail. After trying the accepted answer and it doesn't work, check yourtemplate.blade.php markdown file and ensure you are not closing @endcomponent
twice without a opening @component
Solution 5 - Php
Try using a custom email view template, like this:
You received a message from : {{ $name }}
<p>
Name: {{ $name }}
</p>
<p>
Email: {{ $email }}
</p>
<p>
Message: {{ $user_message }}
</p>
Solution 6 - Php
I had the same problem, then used this syntax and worked as a charm
@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
Where my folder structure views/mail/html
for markdown messages.
and my 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
}
}
Solution 7 - Php
If you want to use markdown in php blade file, then call view by markdown() Or if you want to call blade file by view(), remove markdown syntax from blade file and use plane html.
Solution 8 - Php
I used caffeinated/modules for laravel5.2.
If you are similar to me you can run this:
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 |
+------+-------+-------+-------------------------------------+----------+
All right, you can see the disabled option.
php artisan module:enable Frame
Module is already enabled.
That's all, hope this helps.