'components' => [
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
'useFileTransport' => false, // 这句一定有,false发送邮件,true只是生成邮件在runtime文件夹下,不发邮件
'transport' => [
'class' => 'Swift_SmtpTransport',
'host' => 'smtp.qq.com', // 每种邮箱的host配置不一样
'username' => '1876282830@qq.com',
'password' => 'yzzuvvntfdwocihe', // 注意这里不是邮箱登录密码,而是QQ邮箱后台开启STMP服务后给的授权码
'port' => '587', // 将发送服务器的端口号修改成465或587,163邮箱25;
'encryption' => 'tls'
],
'messageConfig' => [
'charset' => 'UTF-8',
'from' => [
'1876282830@qq.com' => 'some'
]
]
],
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
[
'class' => 'yii\log\DbTarget',
'levels' => ['error', 'warning'],
],
[
'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning'],
],
[
'class' => 'yii\log\EmailTarget',
'levels' => ['error'],
'categories' => ['yii\db\*'],
'message' => [
// 'from' => ['1876282830@qq.com'],
'to' => ['wangjingjing@uniauto.me','qiuchao@uniauto.me'],
'subject' => 'Database errors at example.com',
],
],
],
],
],