Zend框架2发送电子邮件太慢(谷歌的SMTP服务器) [英] The zend framework 2 send email is too slow(google smtp server )

查看:292
本文介绍了Zend框架2发送电子邮件太慢(谷歌的SMTP服务器)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个项目,在那里我需要将通知发送给部分用户,我使用SMTP设置与Zend框架Zend的2 /邮件库。我在php.ini中设置启用TLS和SSL开放

I am working on a project, where i need to send notifications to some users, i am using smtp settings with zend framework 2 Zend/Mail library. I have turned on tls and open ssl in php.ini settings.

问题是通知的方式太缓慢,通常在5个或更多用户使用的同时应用,我得到一个超时错误。

The issue is the notifications are way too slow and usually when 5 or more users are using the application at the same time, i am getting a time out error.

我可以让这个邮件发送速度快使用任何配置?

Can i make this email send faster using any configuration ?

让我知道如果有一些配置可以使用。

Let me know if there is some configuration can be used.

推荐答案

如果我打赌,我敢打赌,有很多延迟到您的SMTP服务器。你说你正在使用谷歌的SMTP,这我并不熟悉,但是这将是一个遥远的服务器(相对于喜欢和SMTP盒在网络上)。最重要的是,你说你正在运行SMTP通过SSL。 SSL是一个复杂的协议有很多握手,甚至建立连接之前。这意味着作为两台机器做SSL握手对话框中您的服务器和SMTP服务之间的网络延迟相乘。总的来说,这是不是一个伟大的设置。

If I had to bet, I'd bet that there's a lot of latency to your SMTP server. You say you're using google for SMTP, which I'm not familiar with, but that's going to be a far away server (relative to like, and SMTP box on your network). On top of that, you say you're running SMTP over SSL. SSL is a complex protocol with a lot handshaking before the connection is even established. This means the network latency between your server and the SMTP service is multiplied as the two machines do the SSL handshake dialog. Overall, it's not a great setup.

某种工作队列中会有帮助。所以,你的网络密集型进程只是坚持一些东西排队工作,一些工人尽最大努力跟上。你可以在PHP中实现类似的东西(你可能会考虑类似的Gearman或beanstalkd提供实际的排队)。

Some kind of work-queue would help. So your web-bound processes just stick stuff jobs on some queue, and some workers do their best to keep up. You could implement something like that in PHP (you might consider something like gearman or beanstalkd to provide the actual queueing).

但是,还有另外一个,非常专业的,选项。只要使用本地的sendmail(假设你是在Unix类型框)。 Sendmail的(和各种直接替代的MTA)维护它自己的队列。这东西已经存在了多年,是相当扎实。你可以设置你的MTA通过你当前的SMTP设置传递邮件,一举多得。

But there's another, very specialized, option. Just use your local sendmail (assuming you're on a unix-type box). Sendmail (and the various drop-in replacements MTAs) maintains it's own queue. This stuff has been around for years and is quite solid. You can configure your MTA to pass the mail on through your current SMTP setup, too.

的差异将是你的PHP脚本聊到远程SMTP服务器,而不是说,它只是谈判本地服务,只是需要的邮件,队列,然后返回在几乎没有时间持平。它拥有邮件队列,直到它可以设法通过SMTP一起发送的。

The difference will be that instead of your PHP script talking to the remote SMTP server, it just talks to a local service which just takes the mail, queues it, and returns in practically no time flat. It holds the mail in the queue until it can manage to send it along via SMTP.

普通老式当地的sendmail会走很长的路要走获得你搞掂。如果你是一个Windows服务器上,我不知道你的选择是什么。必须有,最起码,是你可以运行,可以配置中继所有邮件出通过SSL到google本地SMTP服务器。

Plain old local sendmail will go a long way towards getting you fixed up. If you're on a Windows server, I'm not sure what your options are. There must, at the very least, be a local SMTP server you can run that can be configured to relay all the mail out via SSL to google.

这篇关于Zend框架2发送电子邮件太慢(谷歌的SMTP服务器)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆