GNU Mailutils |
|
General-Purpose Mail Package |
Official GNU Software |
Commands have the following syntax:
command [msglist] [argument ...]
A command is terminated by a newline character. Empty command (i.e. a newline character alone) is equivalent to ‘next’ (see next).
In the syntax above, command is the command verb. Each command has long and short (abbreviated) form. Each of them can be used to invoke the command.
Many mail commands take a list of messages (msglist) to operate upon, which defaults to current message.
The list of messages 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
(integer number) This specifier addresses the message with the given ordinal number in the mailbox.
All messages with ordinal numbers between n and m, inclusive.
All messages of type t, where t can be any of:
Deleted messages.
New messages.
Old messages (any message not in state ‘read’ or ‘new’).
Messages in state ‘read’.
Messages in state ‘unread’.
Selects all tagged messages.
Selects all untagged messages.
Selects all messages in state ‘saved’.
Header match.
Selects all messages that contain header field header matching
given string. If the variable regex
is set, the
string is assumed to be a POSIX regexp. (All comparison is
case-insensitive in either case).
If header: part is omitted, it is assumed to be ‘Subject:’.
Message body match.
Selects all messages with body matching the string. The matching rules are the same as described above.
Some mail
commands can operate on parts of multipart
messages. In arguments to such commands, a message part is indicated by
suffixing the message specifier by a dot and the number of that part
in the message (message parts, as well as messages, are indexed from
1). For example, the command
write 4.1
will operate on part 1 of the message 4. Message parts can in turn be multipart messages. Such nested subparts are indicated in a similar manner, for example:
write 4.1.2
which means subpart 2 of the part 1 of message 4.2
The following are the examples of valid message lists:
Third message.
Messages from 1 through 4 and message 10.
All messages starting from message 4.
All messages with the word ‘watch’ in the subject.
All messages with the word ‘watch’ in the subject or body.
Same as above plus the last message in the mailbox.
Part 2 of the multipart message 10.
For
compatibility with earlier versions of mailutils
, a message
part can also be specified as a list of numbers enclosed in a pair of
brackets, such as ‘4[2]’, instead of ‘4.2’. This syntax is
deprecated and will be withdrawn from future releases.
This document was generated on January 3, 2025 using makeinfo.
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.