如何将 Laravel 可邮寄到变量

Chr*_*ris 6 laravel

我需要获取 Mailable 类的 html

$mail->html = (new InactivityReminder())->"do something to output the html"
Run Code Online (Sandbox Code Playgroud)

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

可邮寄:

class InactivityReminder extends Mailable
{
    use Queueable, SerializesModels;

    public function __construct()
    {

    }

    public function build()
    {
        return $this->markdown('mail.it.inactivityReminder');
    }
}
Run Code Online (Sandbox Code Playgroud)

Ale*_*nin 8

在 5.5 中,该render()方法将渲染您返回的视图Mailable

$html = (new InactivityReminder)->render()
Run Code Online (Sandbox Code Playgroud)