Yii2学习笔记二十四:邮件发送配置
1、commom下main-local.php配置:
'mailer' => [ 'class' => 'yii\swiftmailer\Mailer', 'viewPath' => '@common/mail', // send all mails to a file by default. You have to set // 'useFileTransport' to false and configure a transport // for the mailer to send real emails. 'useFileTransport' => false, 'transport'=>[ 'class'=>'Swift_SmtpTransport', 'host'=>'smtp.qq.com', 'username'=>'邮箱', 'password'=>'smtp密码非邮箱密码', 'port'=>'465', 'encryption'=>'ssl', ], ],2、commom下params.php的管理员邮箱需要和上面的邮箱账号一致:
return [ 'adminEmail' => '邮箱', 'supportEmail' => '', 'user.passwordResetTokenExpire' => 3600, ];3、配置好后,邮件发送基本上可以用,后面就是根据自己的喜好修改邮件的模板。
文章
总共 0 条评论