我有一个单独的spool mbox文件,它是用evolution创建的,包含我希望打印的一系列电子邮件。我的问题是这些邮件没有按时间顺序放入mbox文件中。我想知道使用bash、perl或python将文件从头到尾排序的最佳方法。我想把收到的文件寄给我,并把我寄来的文件寄给我。使用maildir文件会更容易些吗?在
电子邮件当前的格式为:
From x@blah.com Fri Aug 12 09:34:09 2005
Message-ID: <42FBEE81.9090701@blah.com>
Date: Fri, 12 Aug 2005 09:34:09 +0900
From: me <x@blah.com>
User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: someone <someone@hotmail.com>
Subject: Re: (no subject)
References: <BAY101-F9353854000A4758A7E2CCA9BD0@phx.gbl>
In-Reply-To: <BAY101-F9353854000A4758A7E2CCA9BD0@phx.gbl>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
Status: RO
X-Status:
X-Keywords:
X-UID: 371
X-Evolution-Source: imap://x+blah.com@blah.com/
X-Evolution: 00000002-0010
Hey
the actual content of the email
someone wrote:
> lines of quotedtext
我想知道是否有一种方法可以使用这些信息轻松地重新组织文件,也许是用perl或类似的方法。在
如果使用Thunderbird的ImportExportTools插件将邮件消息导入mbox,Python解决方案将无法工作。 存在一个错误:消息应以“from”行作为前缀,格式如下:
但是ImportExportTools的前缀是这样的“from”行:
^{2}$所以有两个错误:
因为Python的邮箱.py/unix邮箱具有硬编码的regexp用于“from”行匹配,某些消息无法分析。在
我给作者写了错误消息,但是有很多错误的导入消息:(。在
这就是在python中实现的方法:
重写mbox的意义是什么,而您可以在加载邮箱时重新排序内存中的邮件?你想订几点?接收日期?发送日期?不管怎样,所有使用mbox的Ruby/Python/Perl模块都可以做到这一点。在
相关问题 更多 >
编程相关推荐