简体   繁体   English

进出口:将邮件保存到唯一文件

[英]Exim: save mail to unique file

The short version: I need to save mail from Exim to a networked directory, but ideally I want to save these as unqiue files rather than appended to a mailbox. 简短的版本:我需要将来自Exim的邮件保存到网络目录中,但理想情况下,我想将这些邮件另存为unueue文件,而不是附加到邮箱中。

The long version: I have a PHP script which parses mail. 长版:我有一个解析邮件的PHP脚本。 Currently this is located on the same box as the mail server, allowing me to pipe the mail directly to the PHP script - easy. 当前,它与邮件服务器位于同一盒子上,这使我可以将邮件直接通过管道传递到PHP脚本-很简单。

Soon my mail server will be hosted on a separate (connected over NFS) server. 不久,我的邮件服务器将托管在单独的(通过NFS连接)服务器上。 My initial plan was to simply create a symlink to the mailbox, and schedule the script to parse the mail via cron, deleting mail after it has been parsed. 我最初的计划是简单地创建到邮箱的符号链接,并安排脚本通过cron解析邮件,在解析邮件后将其删除。

The problem is that the mail is stored in mbox format, ie appended into a single file. 问题在于邮件以mbox格式存储,即附加到单个文件中。 With PHP unable to reliably use file locks over NFS, I'm worried that my script will trash new mail which arrives during execution. 由于PHP无法可靠地使用NFS上的文件锁,我担心我的脚本会丢弃执行期间到达的新邮件。

So - instead of writing mail to a single file, can I get Exim to save each mail into a separate file? 所以-我可以让Exim将每封邮件保存到一个单独的文件中,而不是将邮件写到一个文件中吗?

Thanks for any advice. 感谢您的任何建议。

In short, you use use maildir for your mailboxes instead of mbox. 简而言之,您对邮箱使用use maildir而不是mbox。

Take a look at this how-to on Exim4 and Maildir setup. 看看这个怎么到上运行exim4和Maildir设置。

Something else you can do, is use the PHP IMAP extension to access your local mail server. 您还可以使用PHP IMAP扩展名来访问本地邮件服务器。 This way, each message would be parsed independently as well, and allow you to access individual files without changing your mail server configuration. 这样,每条消息也将被独立地解析,并允许您访问单个文件而无需更改邮件服务器配置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM