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

时间:2021-07-18 14:32:33

I'm using Swiftmailer on a Symfony2. I'm also using Zoho mail to host my mail server and I have configured Swiftmailer using the smpt details provided by Zoho, but it looks like something is wrong because the following exception is thrown:

我在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]'

My parameters.yml file looks like:

我的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

and my config.yml:

和我的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 }

I have tested the connection using telnet and everything seems to be alright:

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

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

What am I missing?

我错过了什么?

Thanks!

5 个解决方案

#1


1  

Well, if you parameters.yml is well loaded then i think i know the problem where it comes from, i think your webhost doesn't allow ssl connection port 465, it refuses the connection thats what the error 111 means, try first to connect using TLS security with port 587. If you still want to use 465 try contacting your web hosting to check that port.

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

Edit :

Remove the "" should fix it

删除“”应修复它

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 }

#2


0  

Change mailer_authmode: plain to mailer_authmode: login.

将mailer_authmode:plain更改为mailer_authmode:login。

#3


0  

After trying with all the solutions (in my development and the production machine) I've tryied PhpMailer. It works perfectly.

在尝试了所有的解决方案后(在我的开发和生产机器中)我试过了PhpMailer。它完美地运作。

I think the problem is in SwiftMailer's code.

我认为问题出在SwiftMailer的代码中。

#4


0  

You need to log into zoho and set up an application specific password. You can find it under Security -> Two Factor Authentication. Use that password instead of your account password.

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

#5


0  

Please note that Zoho Mail does not offer IMAP/POP support anymore with their free plan:

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

```
FREE PLAN
Up to 25 Users
5GB* /User, 25MB Attachment Limit
Webmail access only+. Single domain hosting.
```

+IMAP/POP Support Available exclusively with the paid plans.

+ IMAP / POP支持仅适用于付费计划。

https://www.zoho.com/workplace/pricing.html?src=zmail

Old free plans (registered before 2018???) seem to still have IMAP/POP Support Available

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

Source: https://help.zoho.com/portal/community/topic/zoho-free-tier-pop-imap-activesync-no-longer-free

#1


1  

Well, if you parameters.yml is well loaded then i think i know the problem where it comes from, i think your webhost doesn't allow ssl connection port 465, it refuses the connection thats what the error 111 means, try first to connect using TLS security with port 587. If you still want to use 465 try contacting your web hosting to check that port.

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

Edit :

Remove the "" should fix it

删除“”应修复它

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 }

#2


0  

Change mailer_authmode: plain to mailer_authmode: login.

将mailer_authmode:plain更改为mailer_authmode:login。

#3


0  

After trying with all the solutions (in my development and the production machine) I've tryied PhpMailer. It works perfectly.

在尝试了所有的解决方案后(在我的开发和生产机器中)我试过了PhpMailer。它完美地运作。

I think the problem is in SwiftMailer's code.

我认为问题出在SwiftMailer的代码中。

#4


0  

You need to log into zoho and set up an application specific password. You can find it under Security -> Two Factor Authentication. Use that password instead of your account password.

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

#5


0  

Please note that Zoho Mail does not offer IMAP/POP support anymore with their free plan:

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

```
FREE PLAN
Up to 25 Users
5GB* /User, 25MB Attachment Limit
Webmail access only+. Single domain hosting.
```

+IMAP/POP Support Available exclusively with the paid plans.

+ IMAP / POP支持仅适用于付费计划。

https://www.zoho.com/workplace/pricing.html?src=zmail

Old free plans (registered before 2018???) seem to still have IMAP/POP Support Available

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

Source: https://help.zoho.com/portal/community/topic/zoho-free-tier-pop-imap-activesync-no-longer-free