Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/260.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
带有Zoho smtp服务器的PHP Swiftmailer不发送邮件_Php_Symfony_Configuration_Smtp_Swiftmailer - Fatal编程技术网

带有Zoho smtp服务器的PHP Swiftmailer不发送邮件

带有Zoho smtp服务器的PHP Swiftmailer不发送邮件,php,symfony,configuration,smtp,swiftmailer,Php,Symfony,Configuration,Smtp,Swiftmailer,我在Symfony2上使用Swiftmailer。我还使用Zoho mail来托管我的邮件服务器,并且我使用Zoho提供的smpt详细信息配置了Swiftmailer,但似乎出现了问题,因为引发了以下异常: PHP Fatal error: Uncaught exception 'Swift_TransportException' with message 'Connection could not be established with host 127.0.0.1 [Connection

我在Symfony2上使用Swiftmailer。我还使用Zoho mail来托管我的邮件服务器,并且我使用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]'
My 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
和my 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加载良好,那么我想我知道问题出在哪里,我认为您的Web主机不允许ssl连接端口465,它拒绝连接这就是错误111的意思,请首先尝试使用TLS安全性连接端口587。如果您仍然想使用465,请尝试联系您的web主机以检查该端口

编辑: 删除“”将修复它

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 }

将mailer\u authmode:plain更改为mailer\u authmode:login。

在尝试了所有解决方案(在我的开发和生产机器中)之后。它工作得很好


我认为问题在于SwiftMailer的代码

您需要登录zoho并设置特定于应用程序的密码。您可以在安全->双因素身份验证下找到它。使用该密码而不是您的帐户密码。

请注意,Zoho Mail的免费计划不再提供IMAP/POP支持。

```
FREE PLAN
Up to 25 Users
5GB* /User, 25MB Attachment Limit
Webmail access only+. Single domain hosting.
```
+IMAP/POP支持仅适用于付费计划

旧的免费计划(2018年之前注册?)似乎仍然有IMAP/POP支持


来源:

奇怪的是,它试图转到127.0.0.1而不是smtp.zoho.com,您的config.yml是否将parameters.yml作为资源导入?如何构造邮件?parameters.yml已正确加载,db connection参数位于同一文件中,并且正在工作。这就是我构造邮件的方式:
$message=\Swift\u message::newInstance()->setSubject('Subject')->setFrom(数组('Subject'))name@email.com)->setTo(数组('name@email.com')->setBody($this->renderView('Bundle:Controller:view.txt.twig',数组('data'=>$data));$this->get('mailer')->send($message);
parameters.yml文件已正确加载,数据库连接工作正常,这些参数也在该文件中。我正在使用465端口和SSL连接,因为这是Zoho告诉我要使用的配置。我还尝试了端口587的TLS安全性,但仍然不工作,同样的异常。我想我'我将尝试与他们联系以解决te问题。感谢您的帮助!可能是您的web主机防火墙阻止了该端口,可能不是zoho,所以请先与您的web主机联系我使用的是digital ocean web主机,我将尝试与他们联系。我已阅读,digital ocean正在阻止某些帐户中的SMTP。我已在他们的w谢谢你的帮助!算了吧,我没看到你已经用telnet通过那个端口连接了,真奇怪