【问题标题】:how to read template using swift mailer?如何使用 swift mailer 阅读模板?
【发布时间】:2014-06-25 06:49:33
【问题描述】:

我有一个template file(html file)。我必须在我的邮件中包含这个模板。我如何使用swift mailer阅读模板。

我试过了

 $emailBody = readTemplateFile("http://www.something.in/guitar-mail.html");
    $emailBody_new = str_replace("#name#",$reg_fname,$emailBody);
    $emailBody_new  = str_replace("#email#",$url,$emailBody_new);
    $message->setBody($emailBody_new);

但在邮件中,html 标签和css 显示为平面文本。我该怎么做??

【问题讨论】:

    标签: php templates swiftmailer


    【解决方案1】:

    好的,我终于找到了解决方案..

    换行

    $message->setBody($emailBody_new);
    

    有了这个

    $message->setBody($emailBody_new, "text/html");
    

    这行得通..

    【讨论】:

      猜你喜欢
      • 2011-01-08
      • 1970-01-01
      • 1970-01-01
      • 2019-12-01
      • 2011-04-12
      • 1970-01-01
      • 2014-05-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多