Dennis
Dennis

Reputation: 27

View not found for sending email with laravel 5.4

I'm trying to send an email with Laravel (5.4) but still getting this error:

InvalidArgumentException in FileViewFinder.php line 137:
View [mails.forgot] not found.


at FileViewFinder->findInPaths('mails.forgot', array('{my app dir}/resources/views'))
in FileViewFinder.php line 79
at FileViewFinder->find('mails.forgot')
in Factory.php line 128
at Factory->make('mails.forgot', array('emailAddress' => null, 'connection' => null, 'queue' => null, 'delay' => null, 'message' => object(Message)))
in Mailer.php line 286

Added the file in resources/views/mails/forgot.blade.php

In the controller:

Mail::to('[email protected]')->send(new ForgotEmail());

In the mail file (Mail/ForgotEmail.php) I call:

return $this->view('mails.forgot');

For the rest of my app views are working correctly.

Upvotes: 1

Views: 5955

Answers (2)

Jan
Jan

Reputation: 2522

On my specific case, the my template filename was user.new.blade.php

It would not work. I renamed it to usernew.blade.php and now it works. Seems like there cannot be extra dots in the filename

Upvotes: 0

Clean Laravels caché by issuing either php artisan cache:clear or php artisan config:cache see if that works...

Upvotes: 0

Related Questions