#### 4.3.1 Simple Folder Commands

Within a folder’s buffer, IMAIL provides a number of simple commands that can be used to interact with other folders.

`i URL RET`

  Read the folder named URL and run IMAIL on it (`imail-input`).

`g`

  Get new mail for the current folder (`imail-get-new-mail`).

`C-u g URL RET`

  Read the folder named URL and append all of its messages to the current folder (`imail-input-from-folder`).

`o URL RET`

  Copy the current message into the folder named URL (`imail-output`).

`M-o filename RET`

  Append the current message, in human-readable form, to the file named filename (`imail-file-message`).

`C URL1 RET URL2 RET`

  Copy the folder named URL1 to URL2 (`imail-copy-folder`).

`D URL RET`

  Delete the folder named URL (`imail-delete-folder`).

`R URL1 RET URL2 RET`

  Rename the folder named URL1 to be URL2 (`imail-rename-folder`).

`+ URL RET`

  Create a folder named URL (`imail-create-folder`).

To run IMAIL on a folder other than your primary folder, you may use the `i` (`imail-input`) command in IMAIL. This visits the folder in IMAIL mode. You can use `M-x imail-input` even when not in IMAIL.

The `g` (`imail-get-new-mail`) command gets new mail for the current IMAIL folder, and if there is new mail, moves to the first unseen message. This command works only on IMAP folders; it does nothing on file-based folders. Normally this command isn’t needed since IMAIL periodically checks for new mail in all IMAP folders, but it is occasionally useful to force IMAIL to get new mail immediately rather than waiting for the next periodic mail check. The command `M-x imail` has the same effect as `imail-get-new-mail` if the primary folder is already open in a buffer.

IMAIL normally checks for new mail in IMAP folders according to the value of the variable `imail-update-interval`. This variable specifies the time between checks in seconds. It may also be set to `#f`, which disables automatic mail checking. When IMAIL detects new mail in the primary folder, it normally modifies the mode line of all buffers to contain the string ‘`[New Mail]`’. This can be disabled by setting the variable `imail-global-mail-notification` to `#f`.

To copy messages from another folder into the current folder, give the `g` key a numeric argument, as in `C-u g`. This runs the command `imail-input-from-folder`, which reads a URL and copies all the messages from the specified folder into the current one. The messages are appended to the current folder, in the same order that they appear in the specified folder.

The `o` (`imail-output`) command copies the current message into a folder that you specify as a URL. The folder initially defaults to the current folder, unless you have set the variable `imail-output-default` to a different default; after the first message is output, the default folder becomes the one to which you last output a message. If the target folder doesn’t exist, it is created first; in any case, the copied message is appended to the end of the folder. The current message is flagged as ‘`filed`’. If the variable `imail-delete-after-output` is true, the message is also marked as deleted.

The `M-o` (`imail-file-message`) command appends the current message to a file that you specify. The message is written to the file in the same format in which it appears in the IMAIL buffer, preceded by a separator line if there is other text in the file. This simplifies the task of collecting messages into a plain text file for future reference. Note that attachments appear in the output only as markers; their contents are not included in the file.

The `C` (`imail-copy-folder`) command copies an entire folder from one place to another. You specify two URLs, the source and the target, and all of the messages from the source folder are copied verbatim to the target folder. The source folder is not changed. The target folder is created if it doesn’t exist. If the target folder does exist, the source folder’s messages are appended to it.

Note that all of the commands that copy messages between folders will work whether the folders are the same type or not. In particular, messages in IMAP folders can be copied to file folders, and vice versa. You can copy messages between two file folders in different formats, or between two different IMAP servers. IMAIL doesn’t care; it translates as needed.

The `D` (`imail-delete-folder`) command deletes a specified folder. All of the messages in the folder, and the folder itself, are deleted. You will be prompted to confirm before any deletion is done.

The `R` (`imail-rename-folder`) command renames a specified folder. You are prompted for two URLs, the old name and the new one. At present, this command only works in limited circumstances, specifically, when moving a folder from one place to another on a single IMAP server, or when moving a file folder from one place to another within the same file system. The rename operation fails if the new name is already in use.

The `+` (`imail-create-folder`) command creates a new, empty folder. It prompts for a URL, and signals an error if the name is already in use. This command is rarely used since the message-copying commands automatically create folders as needed.