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

我在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 }

相关文章

文章浏览阅读8.4k次,点赞8次,收藏7次。SourceCodester Onl...
文章浏览阅读3.4k次,点赞46次,收藏51次。本文为大家介绍在...
文章浏览阅读1.1k次。- php是最优秀, 最原生的模板语言, 替代...
文章浏览阅读1.1k次,点赞18次,收藏15次。整理K8s网络相关笔...
文章浏览阅读1.2k次,点赞22次,收藏19次。此网络模型提供了...
文章浏览阅读1.1k次,点赞14次,收藏19次。当我们谈论网络安...