GNU Emacs
Emacs
Dashboard

33.6 Multiple Rmail Files

Rmail operates by default on your primary Rmail file, which is named ~/RMAIL and receives your incoming mail from your system inbox file. But you can also have other Rmail files and edit them with Rmail. These files can receive mail through their own inboxes, or you can move messages into them with explicit Rmail commands (see Copying Messages Out to Files).

i file RET

Read file into Emacs and run Rmail on it ( rmail-input).

g

Merge new mail from current Rmail file’s inboxes ( rmail-get-new-mail).

C-u g file RET

Merge new mail from inbox file file.

To run Rmail on a file other than your primary Rmail file, you can use the i ( rmail-input) command in Rmail. This visits the file in Rmail mode. You can use M-x rmail-input even when not in Rmail, but it is easier to type C-u M-x rmail, which does the same thing.

The file you read with i should normally be a valid mbox file. If it is not, Rmail tries to convert its text to mbox format, and visits the converted text in the buffer. If you save the buffer, that converts the file.

If you specify a file name that doesn’t exist, i initializes a new buffer for creating a new Rmail file.

You can also select an Rmail file from a menu. In the Classify menu, choose the Input Rmail File item; then choose the Rmail file you want. The variables rmail-secondary-file-directory and rmail-secondary-file-regexp specify which files to offer in the menu: the first variable says which directory to find them in; the second says which files in that directory to offer (all those that match the regular expression). If no files match, you cannot select this menu item. These variables also apply to choosing a file for output (see Copying Messages Out to Files).

The inbox files to use are specified by the variable rmail-inbox-list, which is buffer-local in Rmail mode. As a special exception, if you have specified no inbox files for your primary Rmail file, it uses the MAIL environment variable, or your standard system inbox.

The g command ( rmail-get-new-mail) merges mail into the current Rmail file from its inboxes. If the Rmail file has no inboxes, g does nothing. The command M-x rmail also merges new mail into your primary Rmail file.

To merge mail from a file that is not the usual inbox, give the g key a numeric argument, as in C-u g. Then it reads a file name and merges mail from that file. The inbox file is not deleted or changed in any way when g with an argument is used. This is, therefore, a general way of merging one file of messages into another.