Go to the first, previous, next, last section, table of contents.

Rmail Files and Inboxes

The operating system places incoming mail for you in a file that we call your inbox. When you start up Rmail, it runs a C program called movemail to copy the new messages from your inbox into your primary Rmail file, which also contains other messages saved from previous Rmail sessions. It is in this file that you actually read the mail with Rmail. This operation is called getting new mail. You can get new mail at any time in Rmail by typing g.

The variable rmail-primary-inbox-list contains a list of the files which are inboxes for your primary Rmail file. If you don't set this variable explicitly, it is initialized from the MAIL environment variable, or, as a last resort, set to nil, which means to use the default inbox. The default inbox is `/var/mail/username', `/usr/spool/mail/username', or `/usr/mail/username', depending on your operating system.

Some sites use a method called POP for accessing users' inbox data instead of storing the data in inbox files. movemail can work with POP if you compile it with the macro MAIL_USE_POP defined, and then install it setuid to root. It is safe to install movemail in this way.

Assuming you have compiled and installed movemail appropriately, you can specify a POP inbox with a "file name" of the form `po:username'. movemail handles such a name by opening a connection to the POP server. The MAILHOST environment variable specifies the machine to look for the server on.

There are three reason for having separate Rmail files and inboxes.

  1. The inbox file format varies between operating systems and according to the other mail software in use. Only one part of Rmail needs to know about the alternatives, and it need only understand how to convert all of them to Rmail's own format.
  2. The inbox file format usually doesn't provide a place for all the information that Rmail records.
  3. 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 operating 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; then it saves the Rmail file; then it truncates the inbox file. This way, a system crash may cause duplication of mail between the inbox and the Rmail file, but cannot lose mail.

When movemail copies mail from an inbox in the system's mailer directory, it actually puts it in an intermediate file `~/.newmail-inboxname'. Once it finishes, Rmail reads that file, merges the new mail, saves the Rmail file, and only then deletes the intermediate file. If there is a crash at the wrong time, this file continues to exist and Rmail will use it again the next time it gets new mail from that inbox.


Go to the first, previous, next, last section, table of contents.