Next: Deleting Messages, Previous: Sending Messages, Up: Top [Contents][Index]
Mail messages are normally saved to files that contain only mail messages. Such files are called folders. Folders are distinguished from spool files in that VM does not expect other programs to modify them while VM is visiting them. This is important to remember. VM does no locking of folders when visiting them. If the disk copy of a folder is modified behind VM’s back, Emacs will complain with the dreaded “File changed on disk” message when you try to save the folder.
The VM command to save a message to a folder is s
(vm-save-message
); invoking this command causes the current
message to be saved to a folder whose name you specify in the
minibuffer. It can be given a prefix argument n to indicate how
many messages should be saved. Messages saved with
vm-save-message
are flagged “filed”.
Messages can be saved to folders on the local file system or to
folders on an IMAP server.
If vm-folder-directory
is set, vm-save-message
will
insert this directory name into the minibuffer before prompting you
for a folder name; this will save you some typing. If
vm-thunderbird-folder-directory
is set and you enter a Thunderbird
folder using vm-visit-thunderbird-folder
, then that directory
will be the default place for saving messages.
Another aid to selecting folders in which to save mail is the variable
vm-auto-folder-alist
, described in detail below. Using the data
given in this alist, VM can examine the headers of the message and
automatically suggest an appropriate save folder where the message
should be saved.
If you use an IMAP server and prefer to save messages on other folders
on the same IMAP server, you can set the variable
vm-imap-save-to-server
to t. You will be prompted for the name
of the IMAP folder in which to save the message. The variable
vm-auto-folder-alist
can also be used to suggest appropriate save
folders on the IMAP server.
You can override the effect of vm-imap-save-to-server
by using
the specialized commands vm-save-message-to-local-folder
and vm-save-message-to-imap-folder
, which do what their names
indicate.
If the value of the variable vm-confirm-new-folders
is
non-nil
, VM will ask for confirmation before creating a new
folder on interactive saves.
VM can save messages to a folder in two distinct ways. The message can be
appended directly to the folder on disk, or the folder can be visited as
Emacs would visit any other file and the message appended to that
buffer. In the latter method you must save the buffer yourself to change
the on-disk copy of the folder. The variable vm-visit-when-saving
controls which method is used. A value of t
causes VM to always
visit a folder before saving message to it. A nil
value causes VM
to always append directly to the folder file. In this case VM will not
save messages to the disk copy of a folder that is being visited. This
restriction is necessary to insure that the buffer and on-disk copies of
the folder are consistent. If the value of vm-visit-when-saving
is
not nil
and not t
(e.g. 0, the default), VM will append to
the folder’s buffer if the buffer is currently being visited, otherwise VM
will append to the file itself.
After a message is saved to a folder, the usual thing to do next is to
delete it. If the variable vm-delete-after-saving
is
non-nil
, VM will flag messages for deletion automatically after
saving them. This applies only to saves to folders, not for the w
command. There is a separate variable
vm-delete-after-archiving
, which
works like vm-delete-after-saving
but applies to the A
(vm-auto-archive-messages
) command (see below).
The variable vm-auto-folder-alist
is used to specify
pattern-matching rules by which VM can determine an appropriate folder
in which to save a message. The value of this variable should be a
list of the form:
((header-name (regexp . folder-name) ...) ...)
where header-name and regexp are strings, and folder-name is a string or an s-expression that evaluates to a string. The value of folder-name can be
vm-folder-directory
or the
default-directory
of the currently visited folder, whichever is
non-nil, or
If any part of the contents of the message header named by header-name is matched by the regular expression regexp, VM will evaluate the corresponding folder-name and use the result as the default when prompting for a folder to save the message in.
When folder-name is evaluated, the current buffer will contain only
the contents of the header named by header-name. It is safe to
modify this buffer. You can use the match data from any ‘\( …
\)’ grouping constructs in regexp along with the function
buffer-substring
to build a folder name based on the header information.
If the result of evaluating folder-name is a list, then the list will
be treated as another auto-folder-alist and will be descended
recursively.
Whether matching is case-sensitive depends on the value of the variable
vm-auto-folder-case-fold-search
. A non-nil
value makes
matching case-insensitive. The default value is t
, which means
matching is case-insensitive. Note that the matching of header names is
always case-insensitive because the Internet message standard RFC 822
specifies that header names are case indistinct.
Saves a message or messages to a file without their headers. This
command responds to a prefix argument exactly as vm-save-message
does. Messages saved this way are flagged “written”.
vm-auto-archive-messages
)Save all unfiled messages that auto-match a folder via
vm-auto-folder-alist
to their appropriate folders. Messages that
are flagged for deletion are not saved by this command. If invoked with a
prefix argument, confirmation will be requested for each save.
vm-pipe-message-to-command
)Runs a shell command with some or all of the current message as input.
By default, the entire message is used. However, the leading and
trailing message separator lines are not included. When applied to
multiple messages, the command is invoked on each message individually.
If invoked with one C-u the text portion of the message is used.
If invoked with two C-u’s the header portion of the message is used.
In invoked with three C-u’s the visible headers and the text
portions of the message are used.
If the shell command generates any output, it is displayed in a
‘*Shell Command Output*’ buffer. The message itself is not altered.
vm-pipe-message-to-command-discard-output
)Runs a shell command with some or all of the current message as input, like the above, but will not display the output.
vm-pipe-messages-to-command
)Runs a shell command using as input the current message or marked
messages in the mbox format. In contrast to
vm-pipe-message-to-command
, the leading and trailing separator
lines are included. This behaviour can be altered using the variables
vm-pipe-messages-to-command-start
and
vm-pipe-messages-to-command-end
.
vm-pipe-messages-to-command-discard-output
)Runs a shell command using as input the current message or marked messages in the mbox format, but will not display the output.
A non-nil
value of vm-berkeley-mail-compatibility
means to read and write BSD Mail(1) style Status: headers.
This makes sense if you plan to use VM to read mail archives
created by Mail.
Next: Deleting Messages, Previous: Sending Messages, Up: Top [Contents][Index]