我与laravel框架工作,我需要保存html缓存文件,.html或等文件显示在浏览器上比链接是点击通讯电子邮件。(链接:在浏览器中查看电子邮件)
在integration.blade.php中包括@include('emails/header')和@include('emails/footer')
以下是邮件发送代码:
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!');
});在此之后,我需要缓存html。
查看浏览器链接中的电子邮件,使其与address.com/email/?html=gbfvisbiudoanlfdlsakdnlsakndlasn类似
发布于 2015-05-15 15:43:43
您可以使用Sending e-mail in Laravel with custom HTML中使用的主要原则,但是在生成视图之后可以缓存它:
$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!');
});代码是未经测试的,但我相信你明白这个原则。
https://stackoverflow.com/questions/30259835
复制相似问题