[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Recognize mbox files?

From: Harald Hanche-Olsen
Subject: Re: Recognize mbox files?
Date: Mon, 09 Feb 2009 20:09:15 +0100 (CET)

+ Chong Yidong <address@hidden>:

> Richard M Stallman <address@hidden> writes:
> > Is it reliable enough to recognize mbox files
> > that we could visit them automatically in Rmail mode?
> I don't think so.  Mbox files are lines that begin with "From ",
> separated by arbitrary data.  There's not enough information to
> autodetect them.

But there is more: There should be an RFC 822 header behind the "From
" line. Checking for complete RFC 822 compliance may be too much, but
at least, if you look for a bunch of lines matching '^[a-z][-a-z]*:',
each followed by zero or more lines beginning with white space, and
the whole bunch followed by an empty line, you're getting close. Bonus
points for detecting specific headers such as Subject: From: and
Message-ID:. (Beware that some mail programs like to stuff a bogus
message at the start of the mbox file in which they can store their
own data. This message might miss a Message-ID:, but otherwise it
should look normal.)

- Harald

reply via email to

[Prev in Thread] Current Thread [Next in Thread]