gpt4 book ai didi

php - Zend_Mail 发送和 Zend_Progressbar

转载 作者:行者123 更新时间:2023-12-01 06:04:17 25 4
gpt4 key购买 nike

有人知道如何发送带有附件的邮件并在 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com