## Overview ¶

VM (View Mail) is an Emacs subsystem that allows UNIX mail to be read and disposed of within Emacs. Commands exist to do the normal things expected of a mail user agent, such as generating replies, saving messages to folders, deleting messages and so on. There are other more advanced commands that do tasks like bursting and creating digests, message forwarding, and organizing message presentation according to various criteria.

You can make VM your default mail user agent by setting `mail-user-agent` to `vm-user-agent`, e.g. by `M-x` `customize-variable` `RET` `mail-user-agent` `RET`.

To invoke VM, type `M-x vm`. VM gathers any mail that has arrived in your system mailbox and appends it to a mail folder known as your primary inbox, and visits that folder for reading. See Starting Up. Depending on how you have configured VM, the primary inbox might be a file on your file system (in a format understood by VM) or it could be a folder on a remote mail server.

If you type `?` in a VM folder buffer you will get some help, i.e. `vm-help` is called.

If there are any messages in the primary inbox, VM selects the first new or unread message, and previews it. Previewing is VM’s way of showing you part of a message and allowing you to decide whether you want to read it. See Previewing. By default VM shows you the message’s sender, recipient, subject and date headers. Typing `SPC` (`vm-scroll-forward`) exposes the body of the message and flags the message as read. Subsequent `SPC`’s scroll forward through the message, `DEL` scrolls backward. When you reach the end of a message, typing `SPC` or `n` moves you forward to preview the next message. See Paging.

If you do not want to read a message that’s being previewed, type `n` and VM will move to the next message (if there is one). See Selecting Messages.

To save a message to a mail folder use `s` (`vm-save-message`). VM will prompt you for the folder name in the minibuffer. See Saving Messages.

Messages are deleted by typing `d` (`vm-delete-message`) while previewing or reading them. The message is not removed right away; VM makes a note that you want the message to be removed later. If you change your mind about deleting a message, select it and type `u` (`vm-undelete-message`), and the message will be undeleted. See Deleting Messages. The actual removal of deleted messages from the current folder is called expunging and it is accomplished by typing `###` (`vm-expunge-folder`). The message is still present in the on-disk version of the folder until the folder is saved.

Typing `h` (`vm-summarize`) causes VM to display a window containing a summary of the contents of the current folder. The summary is presented one line per message, by message number, listing each message’s author, date sent, line and byte count, and subject. Also, various letters appear beside the message number to indicate that a message is new, unread, flagged for deletion, etc. An arrow ‘`->`’ appears to the left of the line summarizing the current message. The summary format is user configurable, see Summaries.

When you are finished reading mail the current folder must be saved, so that the next time the folder is visited VM will know which messages have been already read, replied to and so on. Typing `S` (`vm-save-folder`) saves the folder. The default behavior is that deleted messages are not expunged automatically when you save a folder. The next time you visit the folder any deleted messages will still be flagged for deletion. see Deleting Messages.

When a folder is first visited, the value of the variable `vm-folder-file-precious-flag` is used to initialize a buffer-local instance of `file-precious-flag`, which determines how folders are saved. A non-nil value causes folders to be saved by writing to a temporary file and then replacing the folder with that file. A nil value causes folders to be saved by writing directly to the folder without the use of a temporary file.

If the folder is empty at the time you save it and the variable `vm-delete-empty-folders` is non-`nil`, VM will remove the zero length folder after saving it.

To quit visiting a folder you can type `q` (`vm-quit`) or `x` (`vm-quit-no-change`). Typing `q` saves the current folder before quitting. Also, any messages flagged new are changed to be flagged as old and unread, before saving. The `x` command quits a folder without changing the status of new messages, saving or otherwise modifying the current folder.

If the variable `vm-confirm-quit` is set to `t` VM will always ask for confirmation before ending a VM visit of a folder. A `nil` value means VM will ask only when messages will be lost unwittingly by quitting, i.e. not removed by intentional delete and expunge. A value that is neither `nil` nor `t` causes VM to ask only when there are unsaved changes to message attributes or when messages will be lost.

You do not have to quit a folder to continue using Emacs for other purposes. `M-x vm-quit-just-bury` buries the buffers associated with the current folder deep in Emacs’ stack of buffers, but otherwise leaves the folder visited so that you can resume reading messages quickly. You can return to the folder using `M-x vm-switch-to-folder`. Or, you can locate the folder’s buffers again by using `list-buffers`, which is normally bound to `C-x C-b`.

Another command you can use if you are using a window system like X Windows is `vm-quit-just-iconify`. This command buries the folder’s buffers like `vm-quit-just-bury` and also iconifies the current frame.

At any time while reading mail in any folder you can type `g` (`vm-get-new-mail`) to check to see if new mail for that folder has arrived. If new mail has arrived it will be moved from the spool files or maildrops associated with the current folder and merged into the folder. If you are not in the middle of another message, VM will also move to the first new or unread message.

If `vm-get-new-mail` is given a prefix argument, it will prompt for another file from which to gather messages instead of the usual spool files. In this case the source folder is copied but no messages are deleted from it as they would be for a spool file.

By default your primary inbox has your system mailbox associated with it, e.g. `/var/spool/mail/kyle`, and so typing `g` will retrieve mail from this file. Your system mailbox is one example of a spool file, a file that the mail transport system delivers messages into. You can associate other spool files with your primary inbox and spool files with other folders by setting the variable `vm-spool-files`. See Spool Files.