Laravel - No hint path defined for [mail] - Solved
I was working on my new blog post about sending email. then i require to use Markdown emails blade template and i found "No hint path defined for [mail]" error in laravel 10 application. if you are using Markdown emails then you need to specify markdown() to call view. you can solve this issue using following way:
You can see the error screenshot:
Laravel 10 No hint path defined for [mail] - Solved
You need to use markdown() on following mail class as like the following way:
return new Content(
view: 'emails.welcome',
);
INTO...
return new Content(
markdown: 'emails.welcome',
);
You can see the full code of mail class:
app/Mail/WelcomeMail.php
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
class WelcomeMail extends Mailable
{
use Queueable, SerializesModels;
public $mailData;
/**
* Create a new message instance.
*/
public function __construct($mailData)
{
$this->mailData = $mailData;
}
/**
* Get the message envelope.
*/
public function envelope(): Envelope
{
return new Envelope(
subject: 'Welcome Mail',
);
}
/**
* Get the message content definition.
*/
public function content(): Content
{
return new Content(
markdown: 'emails.welcome',
);
}
/**
* Get the attachments for the message.
*
* @return array
*/
public function attachments(): array
{
return [];
}
}
Laravel 9 No hint path defined for [mail] - Solved
You need to use markdown() on following mail class as like the following way:
return $this->subject('Happy Birthday '. $this->user->name)
->markdown('emails.birthdayWish');
You can see the full code of mail class:
app/Mail/WelcomeMail.php
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
class BirthDayWish extends Mailable
{
use Queueable, SerializesModels;
public $user;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct($user)
{
$this->user = $user;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this->subject('Happy Birthday '. $this->user->name)
->markdown('emails.birthdayWish');
}
}
I hope it can help you...
Hardik Savani
I'm a full-stack developer, entrepreneur and owner of ItSolutionstuff.com. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Laravel, Angular, Vue, Node, Javascript, JQuery, Codeigniter and Bootstrap from the early stage. I believe in Hardworking and Consistency.
We are Recommending you
- Laravel PayPal Send Payment to Email Example
- Laravel 10 Email Verification Tutorial Example
- Laravel 10 Generate PDF and Send Email Example
- Laravel 10 Send Email using Queue Example
- Laravel 10 Markdown | Laravel 10 Send Email using Markdown Mailables
- Laravel Change Mail Driver Dynamically Example
- Laravel Mail Send with PDF Attachment Example
- How to set CC And BCC Email Address In Laravel Mail?
- Laravel Contact Form Send Email Tutorial
- Laravel Send Email with Multiple Attachment Example
- Laravel Login with Username or Email Example
- How to Concat Two Columns in Laravel?