简体   繁体   English

发送YiiMail时发生Swift_TransportException错误

[英]Error Swift_TransportException when send YiiMail

My website uses Yii Framework, I use YiiMail to send mail, mail is sent well on localhost but can not is sent on live host. 我的网站使用Yii Framework,我使用YiiMail发送邮件,邮件在localhost上发送良好,但不能在实时主机上发送。

When send mail, I get the error: 发送邮件时,出现错误:

Swift_TransportException Failed to authenticate on SMTP server with username "mail@gmail.com" using 2 possible authenticators Swift_TransportException无法使用2个可能的身份验证器在用户名为“ mail@gmail.com”的SMTP服务器上进行身份验证

My config: 我的配置:

    'mail' => array(
        'class' => 'ext.yii-mail.YiiMail',
        'transportType' => 'smtp', // change to 'php' when running in real domain.
        'viewPath' => 'application.views.mail',
        'logging' => true,
        'dryRun' => false,
        'transportOptions' => array(
            'host' => 'smtp.gmail.com',
            'username' => 'mymail@gmail.com',
            'password' => 'pass',
            'port' => '465',
            'encryption' => 'ssl',
        ),
    ),

What kind of server you are using ? 您正在使用哪种服务器?

if linux(centos) then try these commands 如果是linux(centos),请尝试以下命令

$ service httpd restart $ service httpd重新启动

$ setsebool -P httpd_can_network_connect on $ setsebool -P httpd_can_network_connect开启

then try to send emails. 然后尝试发送电子邮件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM