Im working with laravel framework and i need to save html to cache file, .html or etc. file to show on the browser than the link is clicked in the newsletter email. (link: View email in browser).
in the integration.blade.php are included @include('emails/header')
and @include('emails/footer')
here is the mail send code:
Mail::send('emails/integration', array('type' => ucfirst($type)), function($message) use ($type)
{
$message->to( Auth::user()->email, Auth::user()->fullname)->subject('Successful name and '.ucfirst($type).' store integration!');
});
After this i need cache html.
View email in browser link to be like address.com/email/?html=gbfvisbiudoanlfdlsakdnlsakndlasn
You can use the main principle used in Sending e-mail in Laravel with custom HTML but after making the view you can cache it:
$minutes = ...
$viewData = [
'type' => ucfirst($type)
];
$html = Cache::remember('email/integration', $minutes, function()
{
return View::make('email/integration', $viewData)->render();
});
Mail::send('emails.echo', ['html' => $html], function($message) use ($type)
{
$message->to(Auth::user()->email, Auth::user()->fullname)->subject('Successful name and '.ucfirst($type).' store integration!');
});
Code is untested but I'm sure you get the principle.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.