How do I convert a text file of multiple emails to mbox?

0

I have thousands of emails from the nineties that were exported as a text file that I'd like to import into Mail. I'm looking for a way to do that directly or indirectly.

I'm assuming it will require some kind of scripting (PHP, JavaScript, bash, AppleScript...). I would prefer that over 3rd party software but will appreciate whatever advice I get.

Here's a sample of the source:

From k96am03@cc.kzoo.edu  Tue Apr 14 00:30:30 1998
Return-Path: <k96am03@cc.kzoo.edu>
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" <k96am03@cc.kzoo.edu>
X-Sender: k96am03@henson
To: jyh <k96jh01@cc.kzoo.edu>
cc: Ed Mamou <k96em04@cc.kzoo.edu>, Weinhold <k96rw01@cc.kzoo.edu>
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 k96ee01@cc.kzoo.edu  Tue Apr 14 00:35:42 1998
Return-Path: <k96ee01@cc.kzoo.edu>
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 <k96ee01@cc.kzoo.edu>
X-Sender: k96ee01@henson
To: Ed Mamou <k96em04@cc.kzoo.edu>
cc: Weinhold <k96rw01@cc.kzoo.edu>, jyh <k96jh01@cc.kzoo.edu>
Subject: Re: Photos and Food
In-Reply-To: <3532919E.153ED726@kzoo.edu>
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

:)

Aaron Surrain

Posted 2015-12-01T22:54:09.980

Reputation: 103

Answers

2

If they are all inputted as shown in your sample, you are lucky, they are already in mbox format! The quickest way to read is:

$ mail -f ./that90sfile

or, you could append it to the end of your existing user mbox; check your systems man mail to see where it is stored.

pete

Posted 2015-12-01T22:54:09.980

Reputation: 148