GNU Mailutils Manual (split by node):   Section:   Chapter:FastBack: Programs   Up: Reading Mail   FastForward: Libraries   Contents: Table of ContentsIndex: Function Index

3.5.2.1 Syntax of mail internal commands

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

n

(integer number) This specifier addresses the message with the given ordinal number in the mailbox.

n-m

All messages with ordinal numbers between n and m, inclusive.

:t

All messages of type t, where t can be any of:

d

Deleted messages.

n

New messages.

o

Old messages (any message not in state ‘read’ or ‘new’).

r

Messages in state ‘read’.

u

Messages in state ‘unread’.

t

Selects all tagged messages.

T

Selects all untagged messages.

s

Selects all messages in state ‘saved’.

[header:]/string[/]

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:’.

:/string[/]

Message body match.

Selects all messages with body matching the string. The matching rules are the same as described above.

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:

3

Third message.

1-4 10

Messages from 1 through 4 and message 10.

4-*

All messages starting from message 4.

/watch

All messages with the word ‘watch’ in the subject.

/watch :/watch

All messages with the word ‘watch’ in the subject or body.

/watch :/watch $

Same as above plus the last message in the mailbox.

10[2]

Part 2 of the multipart message 10.

GNU Mailutils Manual (split by node):   Section:   Chapter:FastBack: Programs   Up: Reading Mail   FastForward: Libraries   Contents: Table of ContentsIndex: Function Index