在使用swift_mailer时出现了以下错误:
Expected response code 220 but got code "", with message """
解决办法:
这个一般是由于encyption配置导致的
Secure Sockets Layer (SSL)
Transport Layer Security (TLS)
'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.163.com', 'username' => 'jiaowomrwei@163.com', 'password' => 'xxxxxxxxx', 'port' => '25', 'encryption' => 'tls', ], ],
再看看163的SMTP配置说明
所以如果使用ssl端口则encyption配置项必须为465/994如果使用非ssl则应该使用25