Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Extracting attachments from a standalone mailbox

0 views
Skip to first unread message

Howard Kaikow

unread,
Apr 23, 2008, 5:41:55 PM4/23/08
to
Both Eudora and Thunderbird store messages in a format that seems to be
compatible with the format used by sendmail.

Is there a standalone program that will proces a mailbpx directly, outside
of a mail program, and save all the attachments in the mailbox?

If not, which RFC defines the format of mailbox files?


Mark Crispin

unread,
Apr 23, 2008, 6:25:33 PM4/23/08
to
On Wed, 23 Apr 2008, Howard Kaikow posted:

> If not, which RFC defines the format of mailbox files?

There is no such RFC; nor is the format of a mailbox file in scope for any
RFC. RFCs describe protocols, not file formats.

The most common mailbox file format is one in which all messages are in a
single file, delimited with lines which start with "From ", e.g.,
From us...@example.com Wed Apr 23 15:18:20 2008

There are numerious variations on the format of this "From " line,
particularly in the syntax of the date/time; but this format and its
variations collectively is known as "traditional UNIX mailbox format" or
"mbox format".

Any message text which happens to look like a "From " line should have a
">" character inserted in front of it to prevent that line from looking
like a message delimiter line. Some mail programs do this for all lines
that happen to start with "From ", e.g.,
>From the above text, you can see ...
and others only do it with lines that match the syntax.

There may be documents in various UNIX standards and distributions that
define this format in further detail, but the above more or less says
what you need to know.

Note that there are many other mailbox formats, all of which have their
proponents (and detractors). Not all mailbox formats store all the
messages in a single file; for example a common variation stores each
message in its own file.

Nonetheless, traditional UNIX format is the closest there is to a
"universal format". It is inferior and problematic in many ways, but most
software on most systems is capable of reading it (and converting it to
the preferred format, whatever that is).

-- Mark --

http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.
Si vis pacem, para bellum.

Howard Kaikow

unread,
Apr 23, 2008, 6:54:32 PM4/23/08
to
Thanx.

Then the question becomes "Where are the mailbox formats defined?"

About 12 years ago, I created a program that generated a mailbox that coulbe
used either by Eudora or Sendmail.
Now, I've modified that program so the mailbox will work with Thunderbird.

However, none of those include attachments. I might want to add attachments.

At this time, I'm looking for a program that will extract attachments from
an already existing mailbox.
The mailbox would likely be Thunderbird format.

If I can find the spec, I can write the code.


Sam

unread,
Apr 23, 2008, 8:43:03 PM4/23/08
to
Howard Kaikow writes:

> Thanx.
>
> Then the question becomes "Where are the mailbox formats defined?"

By whatever program creates or reads the mailbox.

> About 12 years ago, I created a program that generated a mailbox that coulbe
> used either by Eudora or Sendmail.
> Now, I've modified that program so the mailbox will work with Thunderbird.
>
> However, none of those include attachments. I might want to add attachments.
>
> At this time, I'm looking for a program that will extract attachments from
> an already existing mailbox.

There's no such thing as an "attachments" in a given mailbox. Generally, a
mailbox contains messages, and nothing else. Each individual message may or
may not have attachments.

Generally, attachments in E-mail messages are MIME-formatted. Of course, a
given E-mail client may strip off the attachments from each message, and
store them using some other mechanism. It's entirely up to the E-mail
program.

> The mailbox would likely be Thunderbird format.

Thunderbird generally uses the common mbox format, and leaves the individual
messages as MIME-formatted.

> If I can find the spec, I can write the code.

MIME is specified by the following documents:

http://www.faqs.org/rfcs/rfc2045.html
http://www.faqs.org/rfcs/rfc2046.html
http://www.faqs.org/rfcs/rfc2047.html
http://www.faqs.org/rfcs/rfc2048.html
http://www.faqs.org/rfcs/rfc2049.html

There are also other documents that cover other minor parts of message
formatting, such as http://www.faqs.org/rfcs/rfc2231.html, but you probably
don't need to be concerned with those.

So, basically, you begin by extracting individual messages from the mailbox,
then take each individual messages, and parse its MIME content, then choose
what to do with the message's individual MIME components.

Howard Kaikow

unread,
Apr 24, 2008, 3:02:46 AM4/24/08
to
Thanx.


Kari Hurtta

unread,
Apr 26, 2008, 1:37:04 AM4/26/08
to
Mark Crispin <M...@Washington.EDU> writes in comp.mail.misc:

> On Wed, 23 Apr 2008, Howard Kaikow posted:
> > If not, which RFC defines the format of mailbox files?
>
> There is no such RFC; nor is the format of a mailbox file in scope for
> any RFC. RFCs describe protocols, not file formats.

Actually there turn to be RFC (sort of):

[RFC4155] Hall, E., "The application/mbox Media Type", RFC 4155,
September 2005.


> The most common mailbox file format is one in which all messages are
> in a single file, delimited with lines which start with "From ", e.g.,
> From us...@example.com Wed Apr 23 15:18:20 2008
>
> There are numerious variations on the format of this "From " line,
> particularly in the syntax of the date/time; but this format and its
> variations collectively is known as "traditional UNIX mailbox format"
> or "mbox format".
>
> Any message text which happens to look like a "From " line should have
> a ">" character inserted in front of it to prevent that line from
> looking like a message delimiter line. Some mail programs do this for
> all lines that happen to start with "From ", e.g.,
> >From the above text, you can see ...
> and others only do it with lines that match the syntax.
>
> There may be documents in various UNIX standards and distributions
> that define this format in further detail, but the above more or less
> says what you need to know.
>
> Note that there are many other mailbox formats, all of which have
> their proponents (and detractors). Not all mailbox formats store all
> the messages in a single file; for example a common variation stores
> each message in its own file.
>
> Nonetheless, traditional UNIX format is the closest there is to a
> "universal format". It is inferior and problematic in many ways, but
> most software on most systems is capable of reading it (and converting
> it to the preferred format, whatever that is).

Appendix A. The "default" mbox Database Format


on RFC4155 seems describe that format.

> -- Mark --
>
> http://staff.washington.edu/mrc
> Science does not emerge from voting, party politics, or public debate.
> Si vis pacem, para bellum.

/ Kari Hurtta

Howard Kaikow

unread,
Apr 26, 2008, 8:20:26 AM4/26/08
to
"Kari Hurtta" <hurtta+com...@siilo.fmi.fi> wrote in message
news:5d63u5u...@Hurtta06k.keh.iki.fi...


Thanx.


0 new messages