如何渲染laravel mailable变量

我需要获取Mailable类的html

$mail->html = (new InactivityReminder())->"do something to output the html"

似乎没有toHtml方法或类似的东西.

可邮寄:

class InactivityReminder extends Mailable
{
    use Queueable, SerializesModels;

    public function __construct()
    {

    }

    public function build()
    {
        return $this->markdown('mail.it.inactivityReminder');
    }
}

最佳答案 在5.5中,render()方法将呈现您在Mailable中返回的视图:

$html = (new InactivityReminder)->render()
点赞