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

Xanger's avatar

No hint path defined for [mail].

I'm doing an email blast but I'm getting this error, and each discussion gives a different solution that doesn't work...

NewLogin.php

class NewLogin extends Mailable
{
    use Queueable, SerializesModels;
  
    public $data;

    public function __construct($data)
    {
        $this->data = $data;
    }

    public function build()
    {
        return $this->view('email.newlogin')
                    ->subject('New Login')
                    ->with('body',$this->data);
    }
}

NewLogin.blade.php

@component('mail::message')

# New login to your account

Hi {{ $data['name'] }}, we detected a new login on {{ config('app.name') }}.
 
Browser: {{ $data['browser'] }}
Operating system: {{ $data['os'] }}
Position: {{ $data['position'] }}
IP: {{ $data['ip'] }}
 
If it was you, you can safely ignore this email. If it wasn't you, change your password to help protect your account.

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

LoginController.php

            $data = [
                'name' => $user->username,
                'email' => $user->email,
                'ip' => $ip,
                'os' => $os,
                'browser' => $browser,
                'position' => $city .', '. $region .', '. $country,
            ];           
            \Mail::to($user->email)->send(new \App\Mail\NewLogin($data));

The error page shows me the error in @endcomponent with the error: No hint path defined for [mail].

0 likes
9 replies
LaryAI's avatar
Level 58

The error "No hint path defined for [mail]" occurs when Laravel is unable to locate the view for the email. To fix this, you need to specify the path to the email views in the config/mail.php file.

Open the config/mail.php file and add the following line to the 'markdown' array:

'paths' => [
    resource_path('views/mail'),
],

This tells Laravel to look for email views in the 'resources/views/mail' directory. If you have your email views in a different directory, update the path accordingly.

If you still encounter the same error, try clearing the cache by running the following command:

php artisan config:cache

This should clear the cache and reload the configuration files.

If the error persists, make sure that the email view file exists in the specified directory and that it has the correct file name and extension. In this case, the email view file should be named 'newlogin.blade.php' and should be located in the 'resources/views/mail' directory.

2 likes
Xanger's avatar

keeps giving error, to solve it I used:

return $this->markdown('email.newlogin')

But why am I obliged to use markdown?

5 likes
vicodeveloper's avatar

@Xanger Try to add in config/mail.php

    'markdown' => [
        'theme' => 'default',
        'paths' => [
            resource_path('views/vendor/mail'),
            resource_path('views/emails'), 
        ],
    ],
gbrits's avatar

The true confusion lies in whether you are using html or markdown as @xanger pointed out & indicated the solution.

public function content(): Content
    {
        return new Content(
            markdown: 'emails.new-user', // This part
            with: [
                'user' => $this->user,
                'team' => $this->team,
            ],
        );
    }

or alternatively

public function content(): Content
    {
        return new Content(
            view: 'emails.new-user', // This part
            with: [
                'user' => $this->user,
                'team' => $this->team,
            ],
        );
    }	
4 likes
Snapey's avatar

You have

view('email.newlogin')

but you said the blade view is NewLogin.blade.php

Notice the change in lettercase?

1 like

Please or to participate in this conversation.