I want to customize the mail template components by following the guide of Laravel 5.4, but I get an Error after that:
ErrorException in FileViewFinder.php line 112:
No hint path defined for [mail]. (View: /resources/views/emails/html/order/confirmed.blade.php)
For markdown template, I was unable to embed image in the mail because of this bug:
https://github.com/laravel/framework/issues/17629
@component('mail::message')
<h1>Order Confirmed</h1>
<p>Your order is confirmed!</p>
@component('mail::button', ['url' => $url])
View Order
@endcomponent
<p>
Thanks,<br>
{{ config('app.name') }}
</p>
@endcomponent
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Support\Facades\URL;
use App\Order;
class OrderConfirmed extends Mailable
{
use Queueable, SerializesModels;
/**
* The order instance.
*
* @var Order
*/
public $order;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct(Order $order)
{
$this->order = $order;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this->view('emails.html.order.confirmed')->with(['url' => URL::to('order/show/'.$this->order->id)]);
}
}
These views are used to render the HTML version of the markdown email, I know it may be confusing a bit but these views are only available when you're sending a markdown email.
When you send a markdown email laravel creates an HTML version as well as a markdown version of your email, the html views you are referring are not publicly available as a blade template, they're only accessible from within the markdown email.
@themsaid sorry it's my misunderstanding, I will give markdown mail another try, thanks.
Are you 'themsaid' saying blade rendering is only for markdown?
Most helpful comment
These views are used to render the HTML version of the markdown email, I know it may be confusing a bit but these views are only available when you're sending a markdown email.
When you send a markdown email laravel creates an HTML version as well as a markdown version of your email, the html views you are referring are not publicly available as a blade template, they're only accessible from within the markdown email.