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 有偿求苍穹外卖环境配置
  • ¥15 代码在keil5里变成了这样怎么办啊,文件图像也变了,
  • ¥20 Ue4.26打包win64bit报错,如何解决?(语言-c++)
  • ¥15 clousx6整点报时指令怎么写
  • ¥30 远程帮我安装软件及库文件
  • ¥15 关于#自动化#的问题:如何通过电脑控制多相机同步拍照或摄影(相机或者摄影模组数量大于60),并将所有采集的照片或视频以一定编码规则存放至规定电脑文件夹内
  • ¥20 深信服vpn-2050这台设备如何配置才能成功联网?
  • ¥15 Arduino的wifi连接,如何关闭低功耗模式?
  • ¥15 Android studio 无法定位adb是什么问题?
  • ¥15 C#连接不上服务器,