Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

rene's avatar
Level 2

5.4 error "No hint path defined for [mail]."

Hi, Whats different for 5.4 mails now? Mailables.. but thats lots of work to change for all in all projects. This really simple example doesnt work anymore since upgraded..

The docs are not clear anymore about email.. just refering to mailables and markdown.. I have my emails all in html..

This Function:

public function contact(Request $request)
    {
        $this->validate($request, [
            'name'    => 'required',
            'email'   => 'required|email|max:255',
            'content' => 'required',
        ]);

        $data = $request->all();
        Mail::send(['html' => 'emails.contact'], $data, function ($m) use ($data) {
            $m->from($data['email'], $data['name']);
            $m->cc($data['email'], $data['name']);
            $m->to(config('mail.from.address'), config('mail.from.name'));
        });

        return redirect()->back()->with('success', 'Done');
    }

With this view:

@component('mail::message')


<p>{{ $name }} ({{ $email }} {{ $phone }})</p>

<p><i>
{!! nl2br($content) !!}
</i></p>


@endcomponent

0 likes
6 replies
andrei2506's avatar

Laravel 5.4 does not support sending emails with closures anymore. It was a big change for us too and took 1 week to change all mails to Mailables classes. Basically you need to write a class for every single email you want to send. :-(

Snapey's avatar

eh? you design one view file and then pass in the strings and calls to action as required.

andrei2506's avatar

I am having a very hard time generating the html of an email body that uses @components in the markup. I tried: View::make($view, $data) but it does not work because components and slots are not supported. Does anyone has an answer for this?

TundeMichael's avatar

YOU WANT TO BE ABLE TO GET THE HTML CONTENT OF THE EMAIL I have an answer but it's a workaround.

In your controller, add the following imports

   use Illuminate\Container\Container;
   use Illuminate\Mail\Markdown;

   class RegisterController extends Controller {


   public function register(Request $request) {

         // do registration logic here

         $firstname = 'some_name';
          $url = 'some_url';

          $markdown = Container::getInstance()->make(Markdown::class);
          $html = $markdown->render('emails.contact', compact('firstname', 'url'));
    

            // this is your desired HTML
            Log::info('HTML -->  ' . $html);


        }

   }

Here is my 'mail.confirm_account' markdown

        @component('mail::message')

         Hello {{ $firstname }},
        <p>
         Your signup process has been initiated. Please click the link below to 
          complete your registration and start getting paid. 
        </p>

        @component('mail::button', ['url' => $url, 'color' => 'blue'])
          Confirm Account Now
        @endcomponent

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

And it is located in views\mail

I hope this helps.

2 likes

Please or to participate in this conversation.