【问题标题】:yii2 mandrill mail is sent but not insert containyii2 mandrill 邮件已发送但未插入包含
【发布时间】:2018-12-06 05:16:47
【问题描述】:

如何使用 yii2 nickcv 插件将包含插入到 mandrill 模板中。在这段代码中 test.org 是我的模板名称,我想插入到包含中。任何人都知道它。 这是代码。

\Yii::$app->mailer
->compose('test.org')
->setTo('test@mail.com')
->setSubject($setSubject)
->send();

我只想添加这样的正文

$body = "Hi ,Testing here";

【问题讨论】:

  • 不插入包含 ?
  • 是的,我也使用 setTemplateData('test.org1',$params);其中 $param = array( 'html' => '
    ' . $body . '
    ',);

标签: php email templates yii2 mandrill


【解决方案1】:

你必须像那样使用setHtmlBody函数

$mailSent = Yii::$app->mailer
                ->compose($template_name)
                ->setFrom('test@mail.org')
                ->setTo($to_email)
                ->setSubject($setSubject)
                ->setHtmlBody($setTextBody['html'])
                ->send();
        return $mailSent;

【讨论】:

    猜你喜欢
    • 2014-10-28
    • 1970-01-01
    • 2014-05-12
    • 2015-10-15
    • 2018-09-13
    • 2015-09-11
    • 1970-01-01
    • 2015-10-22
    • 1970-01-01
    相关资源
    最近更新 更多