For a laravel project I want to view how the verify email, email looks.
I did run php artisan vendor:publish --tag=laravel-mail and in the documentation I found:
Sometimes you may wish to capture the HTML content of a mailable without sending it. To accomplish this, you may call the render method of the mailable. This method will return the evaluated contents of the mailable as a string:
$invoice = App\Invoice::find(1);
return (new App\Mail\InvoicePaid($invoice))->render();
Is it possible to do something like this for the confirm email, email? I sarched for Mailable in my project but got no results. Is ther another way to view the email without sending it?
To be honest? Yes you can add routes and make them accessible locally only, but why the hassle.
Laravel already built a tool called Laravel Telescope. Just install with composer, add --dev for development only and be done with it. Set your mail driver to log and inspect without the need to hack around with routes or whatever.
If you wish to test the mail without the hassle of registering all the time, create a factory to generate and mock emails and use Tinker, or better Tinkerwell to speedup your development process.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With