更改邮件目录顺序
我最近问了这个问题并找出了单封电子邮件显示乱序的原因实际上不是因为日期,而是因为消息的顺序。 我想修改我的脚本以确保所有消息都按正确的顺序排列,但我不确定如何执行此操作。 它只是基于文件出现的顺序,还是 maildir 标头中有一个特殊部分指定了这一点?
以下是我的意思的示例: 示例
一般来说,我用的每一个MUA,包括Thunderbird、Evolution和mail2web.com都可以按日期排序,但默认是按“消息编号”排序。 我在一个共享主机上,我相信该主机使用 qmail。 消息号标签信息必须保存在某处。
编辑:我尝试将所有文件移动到临时目录并再次返回,这表明文件顺序负责消息号。 然而,我不确定为什么 12 月几天的消息数量被移动到比该日期两侧的消息数量少得多。 文件名是时间戳并且应该是连续的,因此除非 mv 以奇怪的顺序拍摄文件,否则我不明白为什么不会为这些特定文件恢复消息号。
I recently asked this question and worked out that the reason a single email message is displaying out of order is not in fact because of the date, but because of the order of the messages. I would like to modify my script to make sure all messages are in the correct order, but am unsure how to do this. Is it just based on the order in which the files appear, or is there a special part of the maildir headers which specify this?
Here is an example of what I mean: Example
In general, every MUA I use, including Thunderbird, Evolution and mail2web.com can order by date, but will be default order by the "message number". I am on a shared host which I believe uses qmail. The message number tag information must be kept somewhere.
edit: I tried moving all files to a temp directory and back again, which has shown that it is the file order which is responsible for the message number. I am however unsure as to why the messages from a few days in December have been moved to a much lower number than the numbers of messages on either side of those date. The filenames are timestamps and should be sequential, so unless mv movied the files in a strange order, I do not understand why the message numbers would not be restored for these particular files.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于邮件目录,消息没有固有的顺序。 显示它们的程序可以按其希望的顺序显示它们,该顺序可以是随机的,但也可以基于例如日期标题。
您的示例无法识别显示它们的程序,任何人都可以猜测它如何订购邮件。 您需要弄清楚它的作用并修复它,以便按照您想要的顺序对邮件进行排序。
编辑: Maildir 规范可能对挖掘有用。 如果您的 MTA 实际上通过放置可靠的时间戳来创建唯一的文件名,那么您也许可以按文件名排序。 即使这样的文件名也不能保证,但它可能对您来说已经足够了。
With maildirs, there is no inherent order for the messages. The program that displays them can show them in the order it wishes, which may be random, but can also be based, for example, on the Date header.
Your example does not identify the program that shows them, and it's anybody's guess how it orders the mails. You need to figure out what it does and fix it to order the mails in the order you want.
EDIT: The Maildir specification may be useful for digging out. If your MTA actually creates unique filenames by putting reliable timestamps, you can perhaps make do with ordering by filename. Even such filenames aren't guaranteed, it may be good enough for you.