Node:Specifying Messages, Next:, Previous:Invoking Mail, Up:mail



How to specify message sets

Many mail commands such as print and delete can be given a message list to operate upon. Wherever the message list is omitted, the command operates on the current message.

The message list in its simplest form is one of:

.
Selects current message. It is equivalent to empty message list.
*
Selects all messages in the mailbox.
^
Selects first non-deleted message.
$
Selects last non-deleted message.

In its complex form, the message list is a comma or whitespace-separated list of message specifiers. A message specifier is one of

Message Number
This specifier addresses the message with the given ordinal number in the mailbox.
Message range
Message range is specified as two message numbers separated by a dash. It selects all messages with the number lying within that range.
Attribute specifier
An Attribute specifier is a colon followed by a single letter. The Attribute specifier addresses all messages in the mailbox that have the given attribute. These are the valid attribute specifiers:
:d
Selects all deleted messages.
:n
Selects all recent messages, i.e. the messages that have not been neither read not seen so far.
:o
Selects all messages that have been seen.
:r
Selects all messages that have been read.
:u
Selects all messages that have not been read.
:t
Selects all tagged messages (see Marking Messages).
:T
Selects all untagged messages.

Header match
The header match is a string in the form:
[header:]/string/

It selects all messages that contain header field header matching given regexp. If the variable regexp is set, the string is assumed to be a POSIX regexp. Otherwise, a header is considered to match string if the latter constitutes a substring of the former (comparison is case-insensitive).

If header: part is omitted, it is assumed to be Subject:.

Message body match
The message body match is a string in the form:
:/string/

It selects all messages whose body matches the string. The matching rules are the same as described under "Header match".

A message specifier can be followed by message part specifier, enclosed in a pair of brackets. A message part specifier controls which part of a message should be operated upon. It is meaningful only for multipart messages. A message part specifier is a comma or whitespace - separated list of part numbers or ranges. Each part number can in turn be message part specifier, thus allowing for operating upon multiply-encoded messages.

The following are the examples of valid message lists: