[comp.mail.misc] Format of mail file in /usr/ucb/mail?

haynes@felix.ucsc.edu (99700000) (02/15/91)

Is this documented anywhere?  There are several questions that keep
arising.  Like, one person has a file of saved news articles that
he used to be able to read with mail, but now mail -f <filename>
tells him 0 messages.  In another case when you save news articles
mail will show them with their titles, but after you read them
mail doesn't show the titles anymore.  Can anyone explain?

rickert@mp.cs.niu.edu (Neil Rickert) (02/15/91)

In article <12372@darkstar.ucsc.edu> haynes@felix.ucsc.edu (99700000) writes:
>
>Is this documented anywhere?  There are several questions that keep
>arising.  Like, one person has a file of saved news articles that
>he used to be able to read with mail, but now mail -f <filename>
>tells him 0 messages.  In another case when you save news articles
>mail will show them with their titles, but after you read them
>mail doesn't show the titles anymore.  Can anyone explain?

 I don't know where it is documented.  But my experience show the following:

It consists of a sequence of messages.

Each message begins:

	From sender date_and_time

(I don't know how fussy it is about date, time.  It certainly accepts the
format of the 'date' command).

	Any number of lines of text.

	Empty line.

 The next message will not be recognized if there is no empty line preceding
it.

 Optionally the last header in a message can be 'Status:'.  If the Status:
header is absent the message is assumed new.  Otherwise the contents of
the header indicate whether unread or read.  I don't believe any other
headers are actually necessary, and with the appropriate parameters
/bin/mail can be coaxed into storing a message with no headers (after the
Unix From line).

 ---------------

 Some news software is just poorly designed for saving in mailbox format.
The following seems to apply to 'rn'.  If your environment requests saving
a copy of a mail reply (the MAILRECORD variable), Rnmail does not add the
beginning 'From ' or the trailing blank line.  Thus ucbMail will not
recognize any messages.  If you specified mailbox style saved messages, then
the 's' command will save them in that form if the mailbox does not exist.  If
the mailbox already exists it does a check.  Unfortunately a completely empty
mailbox fails the check, so 'rn' assume non-mailbox format when it saves.

-- 
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
  Neil W. Rickert, Computer Science               <rickert@cs.niu.edu>
  Northern Illinois Univ.
  DeKalb, IL 60115                                   +1-815-753-6940

berg@marvin.e17.physik.tu-muenchen.de (Stephen R. van den Berg) (02/15/91)

In article <1991Feb15.023018.960@mp.cs.niu.edu> rickert@mp.cs.niu.edu (Neil Rickert) writes:
>In article <12372@darkstar.ucsc.edu> haynes@felix.ucsc.edu (99700000) writes:

>>Is this documented anywhere?  There are several questions that keep
>>arising.  Like, one person has a file of saved news articles that
>>he used to be able to read with mail, but now mail -f <filename>
>>tells him 0 messages.  In another case when you save news articles
>>mail will show them with their titles, but after you read them
>>mail doesn't show the titles anymore.  Can anyone explain?

> I don't know where it is documented.  But my experience show the following:

>It consists of a sequence of messages.

>Each message begins:

>	From sender date_and_time

>(I don't know how fussy it is about date, time.  It certainly accepts the
>format of the 'date' command).

The exact (according to numerous experiments from my side, had to know this
because I was writing a mail processor (procmail) that had to 'disarm' bogus
mail headers) regular expression that /usr/ucb/mail looks for to recognize
a new mail message is:
                         "\n\nFrom +[^\t\n ]+ +[^\n\t]"

(If someone can prove me wrong, please say so, I would like to know).
--
Sincerely,                 berg@marvin.e17.physik.tu-muenchen.de
           Stephen R. van den Berg.
"I code it in 5 min, optimize it in 90 min, because it's so well optimized:
it runs in only 5 min.  Actually, most of the time I optimize programs."

dce@smsc.sony.com (David Elliott) (02/21/91)

In article <1991Feb15.023018.960@mp.cs.niu.edu>, rickert@mp.cs.niu.edu (Neil Rickert) writes:
|>  I don't know where it is documented.  But my experience show the following:
|> 
|> It consists of a sequence of messages.
|> 
|> Each message begins:
|> 
|> 	From sender date_and_time

In System V release 4, there is an addition that is important for
people to know about, especially if software being developed is to
be compatible.

In BSD, lines beginning with "From " have the character '>' prepended
to them so they don't look like the beginning of a new message (this
may only happen after a blank line -- I'm not absolutely sure).

In SVR4, two new headers exist: Content-Type and Content-Length.  The
former is used to indicate whether the contents of the mail message
is text, general binary, or some specific format binary data.  The
latter is used to indicate the length of the message body.  Because of
this information, lines beginning with "From " are not modified.

Many existing mail systems don't handle this situation.  I have
modified MH and my own mail browser to handle this, and at least one
person has made modifications to GNU Emacs to handle this.

I'm sure some people will disagree with this change to the mail
message format, but my purpose here is to inform, not to argue a
case.

--
...David Elliott
...dce@smsc.sony.com | ...!{uunet,mips}!sonyusa!dce
...(408)944-4073
..."His lower lip waved poutily with defiance..."