'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發(fā)送到真實的郵箱之中笤成,true會將郵件緩存到文件中
'transport' => [
'class' => 'Swift_SmtpTransport',
'host' => 'smtp.163.com', //每種郵箱的host配置不一樣
'username' => 'youremail@163.com',
'password' => 'yourauthcode',//此處非郵箱密碼评架,而是開啟smtp服務(wù)之后的授權(quán)碼
'port' => '25',
'encryption' => 'tls',
],
'messageConfig'=>[
'charset'=>'UTF-8',
'from'=>['youremail@163.com'=>'admin']
],
],