从文件中读取电子邮件并使用 PEAR 的 Mail_Mime 库发送
在我们基于 php 的电子邮件应用程序中发送邮件时,我遇到了一些问题,特别是我们的邮件服务器接受传入邮件的速率。为了尝试克服这个特定问题,并预防更常见的 SMTP 问题,我尝试将电子邮件写入文件,以便在 SMTP 服务器返回错误时稍后发送。
我目前正在使用 PEAR Mail_Mime 库来发送邮件。根据我阅读的文档 ,可以使用 saveMessage 方法将消息保存到文件中。我的问题在于我的 PHP 脚本需要读取该消息并尝试在稍后阶段再次发送它。除了手动解析文件并查找各种标头“FROM”、“TO”等,然后从头开始手动重建整个邮件对象之外,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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)