我试图在laravel5.1中发送电子邮件,发现Mail:Send使用如下视图模板:
Mail::send(['html.view', 'text.view'], $data, $callback);
问题是我准备好发送HTML正文和TEXT正文来自数据库。如果内容来自数据库,则如何设置html视图和文本视图,如下所示:
$html_body = $row['Html_Body']; // holds html content
$text_body = $row['Text_Body']; // holds text content
谢谢。
要附加文本/纯文本消息,我们可以使用如下所示的addParts方法
$message->to($email_details['to'])
->subject($email_details['subject'])
->from($email_details['from'])
->setBody($email_details['html'], 'text/html');
/* add alternative parts with addPart()*/
$message->addPart($email_details['text'], 'text/plain');
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句