• <legend id='2LpUh'><style id='2LpUh'><dir id='2LpUh'><q id='2LpUh'></q></dir></style></legend>
    • <bdo id='2LpUh'></bdo><ul id='2LpUh'></ul>
    <tfoot id='2LpUh'></tfoot>
  • <i id='2LpUh'><tr id='2LpUh'><dt id='2LpUh'><q id='2LpUh'><span id='2LpUh'><b id='2LpUh'><form id='2LpUh'><ins id='2LpUh'></ins><ul id='2LpUh'></ul><sub id='2LpUh'></sub></form><legend id='2LpUh'></legend><bdo id='2LpUh'><pre id='2LpUh'><center id='2LpUh'></center></pre></bdo></b><th id='2LpUh'></th></span></q></dt></tr></i><div id='2LpUh'><tfoot id='2LpUh'></tfoot><dl id='2LpUh'><fieldset id='2LpUh'></fieldset></dl></div>

    <small id='2LpUh'></small><noframes id='2LpUh'>

      1. 从 Zend Framework 应用程序向数百个收件人发送电子

        时间:2023-10-02
          <bdo id='r17Ly'></bdo><ul id='r17Ly'></ul>
                <tbody id='r17Ly'></tbody>

            • <small id='r17Ly'></small><noframes id='r17Ly'>

            • <tfoot id='r17Ly'></tfoot>

                • <legend id='r17Ly'><style id='r17Ly'><dir id='r17Ly'><q id='r17Ly'></q></dir></style></legend>
                  <i id='r17Ly'><tr id='r17Ly'><dt id='r17Ly'><q id='r17Ly'><span id='r17Ly'><b id='r17Ly'><form id='r17Ly'><ins id='r17Ly'></ins><ul id='r17Ly'></ul><sub id='r17Ly'></sub></form><legend id='r17Ly'></legend><bdo id='r17Ly'><pre id='r17Ly'><center id='r17Ly'></center></pre></bdo></b><th id='r17Ly'></th></span></q></dt></tr></i><div id='r17Ly'><tfoot id='r17Ly'></tfoot><dl id='r17Ly'><fieldset id='r17Ly'></fieldset></dl></div>
                • 本文介绍了从 Zend Framework 应用程序向数百个收件人发送电子邮件的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在尝试为我的应用程序实现一个邮件列表系统.我目前使用 Zend_Mail_Transport_Smtp('localhost') 作为我的传输,循环浏览我的订阅者列表,并向每个订阅者发送一个新的 Zend_Mail.但是,我注意到脚本完成所需的时间随着订阅者数量的增加而增加.

                  I'm trying to implement a mailing list system for my application. I'm currently using Zend_Mail_Transport_Smtp('localhost') as my transport, looping through my list of subscribers, and sending a new Zend_Mail to each one. However, I am noticing that the length of time that it takes for the script to complete increases as the number of subscribers increase.

                  我相信一定有更专业的方法来做到这一点,包括电子邮件排队.我想最理想的方法是让用户填写表单,点击发送,然后立即得到回复说正在发送电子邮件,而不是等待数百封电子邮件发送完毕.

                  I'm sure there must be a more professional approach to doing this, involving the queuing of emails. I suppose the ideal approach would be for the user to fill out the form, click send, and immediately get a response saying that the emails are being sent, rather than waiting for the hundreds of emails to finish sending.

                  我知道 Zend_Mail 不做任何排序邮件排队.任何有这方面经验的人都可以给我一个关于如何做到这一点的概述吗?我对 cron/crontab/cronjobs 一无所知,所以如果涉及到,请解释一下过程.

                  I understand that Zend_Mail does not do any sort mail queuing. Could anyone who has experience with this, give me an overview of how this can be done? I don't know anything about cron/crontab/cronjobs, so if it involves that, please explain the process.

                  推荐答案

                  为了使用 PHP 可靠地发送大量电子邮件,您必须使用排队机制.正如其他人所建议的,使用队列的过程如下所示:

                  In order to reliably send a large number of emails using PHP you have to use a queueing mechanism. As suggested by others, the process of using a queue looks something like this:

                  • 遍历您的一组用户,为每个用户创建电子邮件并可能自定义内容
                  • 将每个邮件对象传递到队列,这将延迟发送电子邮件
                  • 在某种 cron 脚本中,一次发送数百个队列内容.注意:您需要通过查看日志以查看实际发送过程中返回的错误来调整发送的电子邮件数量.如果您尝试发送太多邮件,我已经注意到邮件传输将不再接受连接(我使用的是 qmail)

                  您可以使用一些库来执行此操作,PEAR 邮件队列(使用 Mail_Mime)和 SwiftMailer 都允许您创建和排队电子邮件.到目前为止,Zend Mail 只提供电子邮件的创建,不提供排队(稍后会详细介绍).

                  There are a few libraries out there you can use to do this, PEAR Mail Queue (with Mail_Mime) and SwiftMailer both allow you to create and queue emails. So far, Zend Mail only provides for creation of emails, not queueing (more on that later).

                  我主要有使用 PEAR 邮件队列 的经验,但有一些问题.如果您尝试将大量电子邮件排队(例如,循环超过 20,000 个用户并尝试在合理的时间内将他们放入队列),则使用 Mail Mime 的带引号的可打印编码实现非常慢.您可以通过切换到 base64 编码来加快速度.

                  I have experience primarily with PEAR Mail Queue and there are a few gotchas. If you are trying to queue up a large number of emails (for instance, looping over 20,000 users and trying to get them into the queue in a reasonable time), using Mail Mime's quoted-printable encoding implementation is very slow. You can speed this up by switching to base64 encoding.

                  对于 Zend Mail,您可以编写一个 Zend Mail Transport 对象,将您的 Zend Mail 对象放入 PEAR 邮件队列.我已经取得了一些成功,但需要花点时间才能做到正确.为此,请扩展 Zend Mail Transport Abstract,实现 _sendMail 方法(您将在该方法中将 Zend Mail 对象放入邮件队列)并将传输对象的实例传递给 Zend Mail 对象的 send() 方法或通过 Zend Mail::setDefaultTransport().

                  As for Zend Mail, you can write a Zend Mail Transport object that puts your Zend Mail objects into the PEAR Mail Queue. I have done this with some success, but it takes a bit of playing to get it right. To do this, extend Zend Mail Transport Abstract, implement the _sendMail method (which is where you will drop your Zend Mail object into the Mail Queue) and pass the instance of your transport object to the send() method of your Zend Mail object or by Zend Mail::setDefaultTransport().

                  最重要的是,您可以通过多种方式做到这一点,但这需要您进行一些研究和学习.然而,这是一个非常容易解决的问题.

                  Bottom line is that there are many ways you can do this, but it will take some research and learning on your behalf. It is a very solvable problem, however.

                  这篇关于从 Zend Framework 应用程序向数百个收件人发送电子邮件的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:HTTP 与 FTP 上传 下一篇:Zend_Session/Zend_Auth 随机抛出错误信息 ps_files_clea

                  相关文章

                  最新文章

                • <i id='Xtz24'><tr id='Xtz24'><dt id='Xtz24'><q id='Xtz24'><span id='Xtz24'><b id='Xtz24'><form id='Xtz24'><ins id='Xtz24'></ins><ul id='Xtz24'></ul><sub id='Xtz24'></sub></form><legend id='Xtz24'></legend><bdo id='Xtz24'><pre id='Xtz24'><center id='Xtz24'></center></pre></bdo></b><th id='Xtz24'></th></span></q></dt></tr></i><div id='Xtz24'><tfoot id='Xtz24'></tfoot><dl id='Xtz24'><fieldset id='Xtz24'></fieldset></dl></div>
                  <tfoot id='Xtz24'></tfoot>
                      <bdo id='Xtz24'></bdo><ul id='Xtz24'></ul>

                    <small id='Xtz24'></small><noframes id='Xtz24'>

                  1. <legend id='Xtz24'><style id='Xtz24'><dir id='Xtz24'><q id='Xtz24'></q></dir></style></legend>