[ 'db' => [ 'class' => 'yii\db\Connection', 'dsn' => 'mysql:host=127.0.0.1;dbname=ws_test_hanyiyun', 'username' => 'ws_test_hanyiyun', 'password' => '3ZMjJfGXTSMBaX4k', 'charset' => 'utf8', 'tablePrefix'=>'bd_' ], '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,//这句一定有,false发送邮件,true只是生成邮件在runtime文件夹下,不发邮件 'transport' => [ //这里如果你是qq的邮箱,可以参考qq客户端设置后再进行配置 http://service.mail.qq.com/cgi-bin/help?subtype=1&&id=28&&no=1001256 'class' => 'Swift_SmtpTransport', //163邮箱 // 'host' => 'smtp.163.com', // 'username' => 'test@163.com', //发送方邮箱 // 'password' => 'sss', ///如果是163邮箱,此处要填授权码,不是邮箱密码 // 'port' => '25',//服务器端口 // 'encryption' => 'tls',//加密方式 //qq邮箱 'host' => 'smtp.qq.com', 'username' => '997661236@qq.com', //发送方邮箱 'password' => '输入密码', 'port' => '465',//服务器端口 'encryption' => 'ssl', ], 'messageConfig'=>[ 'charset'=>'UTF-8', 'from'=>['997661236@qq.com'=>'豪省心'] //邮件里面显示的邮件地址和名称 ], ], ], ];