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