代码之家  ›  专栏  ›  技术社区  ›  Juan

如何在cakephp3.6中返回数据为原始html的电子邮件模板?

  •  0
  • Juan  · 技术社区  · 7 年前

    大家好,我这里有一个使用模板发送电子邮件的代码,我想返回原始html模板。我怎样才能做到这一点?

    $email = new Email();
        $email
            ->template('changelogrequest')
            ->emailFormat('html')
            ->subject($subject)
            ->to($to)
            ->from($this->from)
            ->viewVars($data);
    
        // get raw html here
    
        // Log::debug($email->getLayout());
        $email->send();
    
    1 回复  |  直到 7 年前
        1
  •  1
  •   Greg Schmidt    7 年前

    send()方法返回包含原始html的电子邮件信息数组。多亏了格雷格·施密特。

     $html = email->send();
     Log::debug($html)
    
    推荐文章