Rmail Files and Inboxes
***********************
Unix places your incoming mail in a file called your "inbox". When
you start up Rmail, it copies the new messages from your inbox into
your primary mail file, an Rmail file which also contains other messages
saved from previous Rmail sessions. In this file, you actually read
the mail with Rmail. The operation is called "getting new mail". You
can repeat it at any time using the `g' key in Rmail. The inbox file
name is `/usr/spool/mail/USERNAME' in Berkeley Unix,
`/usr/mail/USERNAME' in system V.
There are two reason for having separate Rmail files and inboxes.
1. The format in which Unix delivers the mail in the inbox is not
adequate for Rmail mail storage. It has no way to record
attributes (such as `deleted') or user-specified labels; it has no
way to record old headers and reformatted headers; it has no way
to record cached summary line information.
2. It is very cumbersome to access an inbox file without danger of
losing mail, because it is necessary to interlock with mail
delivery. Moreover, different Unix systems use different
interlocking techniques. The strategy of moving mail out of the
inbox once and for all into a separate Rmail file avoids the need
for interlocking in all the rest of Rmail, since only Rmail
operates on the Rmail file.
When getting new mail, Rmail first copies the new mail from the inbox
file to the Rmail file and saves the Rmail file. It then deletes the
inbox file. This way a system crash may cause duplication of mail
between the inbox and the Rmail file, but it cannot lose mail.
Copying mail from an inbox in the system's mailer directory actually
puts it in an intermediate file, `~/.newmail'. This is because the
interlocking is done by a C program that copies to another file.
`~/.newmail' is deleted after mail merging is successful. If there is
a crash at the wrong time, this file will continue to exist and will be
used as an inbox the next time you get new mail.