如何将包含多封电子邮件的文本文件转换为 mbox?

如何将包含多封电子邮件的文本文件转换为 mbox?

我有数千封 90 年代的电子邮件,它们被导出为文本文件,我想将它们导入到 Mail 中。我正在寻找一种直接或间接地做到这一点的方法。

我假设它需要某种脚本(PHP、JavaScript、bash、AppleScript……)。我更喜欢第三方软件,但我也非常感激任何建议。

以下是源代码的一个示例:

From [email protected]  Tue Apr 14 00:30:30 1998
Return-Path: <[email protected]>
Received: from localhost (k96am03@localhost)
    by henson.cc.kzoo.edu (8.8.7/8.8.7) with SMTP id AAA18346;
    Tue, 14 Apr 1998 00:30:10 -0400 (EDT)
Date: Tue, 14 Apr 1998 00:30:10 -0400 (EDT)
From: "Andrew J. MacTavish" <[email protected]>
X-Sender: k96am03@henson
To: jyh <[email protected]>
cc: Ed Mamou <[email protected]>, Weinhold <[email protected]>
Subject: Re: Photos and Food
In-Reply-To: <Pine.SOL.3.95q.980413233932.15639B-100000@henson>
Message-ID: <Pine.SOL.3.95q.980414002846.16905B-100000@henson>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Status: OR

hi guys.

hey i was thinking that three is to early in the day.  would like six or
seven be cooler?  i think they would.  let us know what you think.


tata
-andymac

-be careful not to catch a cold ed

From [email protected]  Tue Apr 14 00:35:42 1998
Return-Path: <[email protected]>
Received: from localhost (k96ee01@localhost)
    by henson.cc.kzoo.edu (8.8.7/8.8.7) with SMTP id AAA18558;
    Tue, 14 Apr 1998 00:35:26 -0400 (EDT)
Date: Tue, 14 Apr 1998 00:35:26 -0400 (EDT)
From: Emily Ebenhoe <[email protected]>
X-Sender: k96ee01@henson
To: Ed Mamou <[email protected]>
cc: Weinhold <[email protected]>, jyh <[email protected]>
Subject: Re: Photos and Food
In-Reply-To: <[email protected]>
Message-ID: <Pine.SOL.3.95q.980414003446.18477B-100000@henson>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Status: OR

THAT'S AWESOME!  we should write them back or something just cuz they're
cool.
how was everyone's weekend?  remember sunday's the fun day

:)

答案1

如果他们是全部输入如示例所示,您很幸运,它们已经mbox格式化了!最快的读取方式是:

$ mail -f ./that90sfile

或者,您可以将其附加到现有用户 mbox 的末尾;检查您的系统man mail以查看其存储位置。

相关内容