yii2山d邮件已发送但未插入包含

时间:2018-06-27 10:34:01

标签: php email templates yii2 mandrill

如何使用yii2 nickcv 插件将包含内容插入到mandrill模板中。在此代码中, test.org 是我的模板名称,我想插入到contains中。任何人对此都有想法。 这是代码。

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

我只想添加这样的身体

$body = "Hi ,Testing here";

1 个答案:

答案 0 :(得分:0)

您必须像这样使用setHtmlBody函数

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