Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Preview Laravel Mail before sending

I want to edit my mail and change everything, if I want, as shown here.

Ive imported my file and created a test route to view the page:

use Illuminate\Mail\Markdown;

Route::get('/mail/html', function () {
    $markdown = new Markdown(view(), config('mail.markdown'));
    return $markdown->render('vendor.mail.html.message'); // or ..markdown.message
});

However, Im having variable errors for @slot. How to view my change/see what the mail looks like before sending? Another package for that?

Thanks

like image 352
Sylar Avatar asked Oct 19 '25 04:10

Sylar


1 Answers

To preview your email in browser please add below code to route

Route::get('preview-notification', function () {
 $markdown = new \Illuminate\Mail\Markdown(view(), config('mail.markdown'));   
 $data = "Your data to be use in blade file";
 return $markdown->render("path-of-your-templete-blade-file", $data]);
}); 

and you will be access your templete using

http://your-application-url/preview-notification
like image 161
waseem asgar Avatar answered Oct 22 '25 05:10

waseem asgar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!