php - Zend_Mail 发送和 Zend_Progressbar

标签 php jquery email zend-mail

有人知道如何发送带有附件的邮件并在 JavaScript (jQuery) 中显示进度条的好例子吗?

最佳答案

您可能需要猜测所需的时间并据此更新进度条。

Given that PHP doesn't have threading, I would suggest having a database queue for deliveries, and have an external PHP process triggered from the main site (or via cron) that processes the deliveries on the side, marking on the database the current status on each delivery: NOT_PROCESSED, IN_PROGRESS, CONNECTING, CONNECTED, SENDING_DATA, ACCEPTED, FAILURE_X . You can query the database for the status on each delivery via Ajax.

If PHPMailer internally uses the standard PHP mail() function, which uses a relay SMTP server in your machine, you cannot have that much information about status (which you would have if you created the sockets yourself), you can have just three main states NOT_PROCESSED, IN_PROGRESS, FAILURE_X.

Is it possible to send mail asycronously using PHP while giving user feedback on delivery?

否则,也许您可​​以在每个小步骤之后更新进度条。像这样任意的东西:

  1. 设置邮件收件人
    • 更新进度条25%
  2. 设置邮件发件人地址
    • 更新进度条50%
  3. 设置邮件标题
    • 更新进度条75%
  4. 发送邮件
    • 将进度条更新为 100%

然而,这确实效率很低。最终结果可能是用户看到进度条在前三个(25%、50%、75%)中快速跳跃,然后卡在 75% 处再多一两秒,然后就完成了..

关于php - Zend_Mail 发送和 Zend_Progressbar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8098706/

相关文章:

php - 使用 PHPCassa 的 PHP 中的雪花 key 算法

php - PHP 中的简单洪流系统?

php - undefined variable 错误,但我想要的是工作正常

javascript - 将背景颜色链接到滚动位置

javascript - 尝试记录动态添加的元素时为“未定义”

javascript - 选择 Jquery : Change multiple chosen values separator to pipeline instead of comma

javascript - Meteor 忘记密码和发送重置密码电子邮件数据流

php - 服务器使用 gmail 发送电子邮件 smtp 获取警报

email - Cakephp:电子邮件错误 SSL

c# - 551 发件人地址对您的登录无效