Laravel - No hint path defined for [mail] - Solved

By Hardik Savani November 5, 2023 Category : Laravel

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...

Tags :
Shares