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.

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:

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.

Footnotes

(2)

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.

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