🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.mail.misc
Article #972

Re: What is the format of a mailbox file?

#972
From: Raphael Manfredi
Date: Wed, 26 Aug 1992 23:04
52 lines
2732 bytes
Quoting sdm7g@aemsun.med.Virginia.EDU (Steven D. Majewski) from comp.lang.perl:
>What is the format of a unix mailbox file and where can the 
>definition be found. ( I didn't see any pointers in the man
>page for 'mail'. )

The format of the *unix* mail box (i.e. the format in which the mail
delivery subsystem stores the mail in the system mail box) is really
simple:

It starts with a From line describing the sender of the message (idented
for clarity only):

	From <internet_address> <date string> [remote from <site>]

For instance:

	From ram@lyon.eiffel.com  Wed Aug 26 16:02:12 1992

The "remote from" part is used by UUCP and apparently by SYSV R4 mail.
It is not recognized by old mail programs, I think.

Then the RFC-822 mail follows. It is composed of a set of headers, a
blank line (single newline) which marks the end of header, and then the
body of the mail itself. Note that the end of the message is marked by the
end of the file, or the beginning of another message. This is why it is
important to escape the leading "From" lines in the body of a message, or
some simple mail handling tools are confused. Usually, appending a '>' as in
>From is sufficient.

>How is the status of new, read, etc. indicated in the file? 

This is a mail user-agent convention, and it may vary. But traditional
/usr/bin/mailx (aka /usr/ucb/Mail) simply add a Status: line in the header
of the message.

>BTW: the reason for the question is that I need to write a filter
>to split/merge and generally reorganize my mailboxes. If anyone has
>any hints on a good program to do this, I'm listening. And that's why
>I've tacked 'comp.lang.perl' onto the Newsgroups line. I would expect
>someone must have done something like this in Perl, already. 

Sorry, I only have a perl program to sort message *before* they arrive into
your mailbox. For post-processing, I use MH, which stores messages in
individual files -- makes life *much* easier as you may use traditional
shell scripts to process your mail and don't even have to use perl! :-)

Good luck!
-- 
Raphael Manfredi <ram@eiffel.com>
Interactive Software Engineering Inc.
270 Storke Road, Suite #7                      / Tel +1 (805) 685-1006 \
Goleta, California 93117, USA                  \ Fax +1 (805) 685-6869 /
Technical Details
Message-ID: <122@eiffel.eiffel.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!eiffel!eiffel.com
References: <1992Aug26.203046.25591@murdoch.acc.Virginia.EDU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!eiffel!eiffel.com
From: ram@eiffel.com (Raphael Manfredi)
Newsgroups: comp.mail.misc
Subject: Re: What is the format of a mailbox file?
Message-ID: <122@eiffel.eiffel.com>
Date: 26 Aug 92 23:04:14 GMT
References: <1992Aug26.203046.25591@murdoch.acc.Virginia.EDU>
Sender: ram@eiffel.com
Distribution: na
Organization: Interactive Software Engineering, Santa Barbara CA
Lines: 52