相关疑难解决方法(0)

使用自定义HTML在Laravel中发送电子邮件

我需要发送电子邮件,但我已经生成了HTML,我不想使用laravel blade,因为我需要将CSS内联应用于HTML,所以这就是我生成html的方式:

getRenderedView($viewData) {
    //code
    $html =  View::make('email.notification', $viewData)->render();
    $this->cssInliner->setCSS($this->getCssForNotificationEmail());
    $this->cssInliner->setHTML($html);
    return $this->cssInliner->convert();
}
Run Code Online (Sandbox Code Playgroud)

因此,要使用Laravel发送邮件,您通常会执行以下操作:

Mail::send('emails.welcome', $data, function($message)
{
    $message->to('foo@example.com', 'John Smith')->subject('Welcome!');
});
Run Code Online (Sandbox Code Playgroud)

但是我不想传递视图,我已经有了html,我该怎么做?

php email laravel

5
推荐指数
2
解决办法
1万
查看次数

标签 统计

email ×1

laravel ×1

php ×1