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 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 spring后端vue前端
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题