dpx49470 2011-04-26 05:29
浏览 62
已采纳

从文件中读取电子邮件并使用PEAR的Mail_Mime库发送

I've come across a few issues when sending mail in our php-based email application, specifically the rate at which our mail server will accept incoming mail. To try overcome this particular problem, and also to preempt more general SMTP issues, I'm trying to write an email to file for later sending if the SMTP server returns an error.

I'm currently using the PEAR Mail_Mime library to send mail. From what I've read in the docs, it's possible to save a message to file using the saveMessage method. My problem comes in where my PHP script needs to read that message and attempt to send it again at a later stage. Short of manually parsing the file and looking for the various headers "FROM", "TO", etc, and then manually reconstructing the entire mail object from scratch, is there any function in the Mail_Mime library that allows me to read the entire file at once and reconstruct the various parts and headers automatically?

  • 写回答

1条回答 默认 最新

  • doz59484 2011-04-26 05:33
    关注
    1. Serialize your constructed mail object
    2. Insert it into some form of queue (database, directory full of files containing 1 message each, beanstalkd)
    3. daemon reads entries from the queue one at a time
    4. Deserialize
    5. Send message
    6. sleep until next allowed send (1 second? 30 seconds? 60 seconds?)
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测