yii2:如何将变量发送到phpmailer的页面

时间:2017-07-24 07:20:46

标签: yii yii2 phpmailer

这是我的邮件配置:

      'mail' => [
            'class' => 'zyx\phpmailer\Mailer',
//            'viewPath' => 'mail',
            'useFileTransport' => false,
            'config' => [
                'mailer' => 'smtp',
                'host' => 'mail.poorad.com',
                'port' => '25',
//                'smtpsecure' => 'tls',
                'smtpauth' => true,
                'username' => '***@poorad.com',
                'password' => '***',
            ],
        ],

这是我发送邮件的代码:

$a = Yii::$app->mail->compose('passwordResetToken', ['mili' => 'miliii'])
            ->setFrom('from@domain.com')
            ->setTo('mysaltern@gmail.com')
            ->setSubject('Advanced email from Yii2-SwiftMailer')
            ->send();

但在:

<?php



echo $mili;

我有这个错误:Undefined variable: mili

我如何才能访问$ mili?

0 个答案:

没有答案