加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

PHP Swiftmailer与Zoho smtp服务器不发送邮件

发布时间:2020-12-13 22:54:53 所属栏目:PHP教程 来源:网络整理
导读:我在Symfony2上使用 Swiftmailer.我也使用Zoho邮件来托管我的邮件服务器,我使用Zoho提供的smpt详细信息配置了Swiftmailer,但看起来有些错误,因为引发了以下异常: PHP Fatal error: Uncaught exception 'Swift_TransportException' with message 'Connection
我在Symfony2上使用 Swiftmailer.我也使用Zoho邮件来托管我的邮件服务器,我使用Zoho提供的smpt详细信息配置了Swiftmailer,但看起来有些错误,因为引发了以下异常:

PHP Fatal error:  Uncaught exception 'Swift_TransportException' with message 'Connection could not be established with host 127.0.0.1 [Connection refused #111]'

我的parameters.yml文件看起来像:

parameters:
    mailer_transport: smtp
    mailer_host: smtp.zoho.com
    mailer_port: 465
    mailer_encryption: ssl
    mailer_user: my_username
    mailer_password: my_password
    mailer_authmode: plain

和我的config.yml:

swiftmailer:
    transport: "%mailer_transport%"
    host:      "%mailer_host%"
    port:      "%mailer_port%"
    encryption: "%mailer_encryption%"
    username:  "%mailer_user%"
    password:  "%mailer_password%"
    auth_mode: "%mailer_authmode%"
    spool:     { type: memory }

我已经使用telnet测试了连接,一切似乎都没问题:

root:/# telnet smtp.zoho.com 465
Trying 74.201.154.90...
Connected to smtp.zoho.com.
Escape character is '^]'.

我错过了什么?

谢谢!

解决方法

好吧,如果你的parameters.yml加载良好,那么我想我知道它来自哪里的问题,我认为你的webhost不允许ssl连接端口465,它拒绝连接那个错误111意味着什么,首先尝试连接使用端口587的TLS安全性.如果您仍想使用465,请尝试联系您的虚拟主机以检查该端口.

编辑:

删除“”应修复它

swiftmailer:
    transport: %mailer_transport%
    host:      %mailer_host%
    port:      %mailer_port%
    encryption: %mailer_encryption%
    username:  %mailer_user%
    password:  %mailer_password%
    auth_mode: %mailer_authmode%
    spool:     { type: memory }

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读