How to test email sending in Laravel 5.3 using artisan tinker

I’m building a Laravel app and ran into an error when trying to send mail but wasn’t getting an error back since the request was posted through ajax. If you’re trying to troubleshoot it, artisan tinker app is very useful to get more information on the error.

Fire up terminal/command line and run:

and then run the following snippet:

Change emails.test to point to a blade that works and populate the email you want to test.

You should either see a success/null message if everything was correct, or an error with details on what went wrong. The error I encountered required configuring 2FA in Gmail or setting the insecure app option up to send through Gmail for testing.


There are no comments.

Leave a Reply