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

3.8 readmsg — Extract Messages from a Folder

The readmsg utility extracts messages from a mailbox according to the criteria specified in the command line. These criteria are:

  1. A lone ‘*’ means “select all messages in the mailbox”.
  2. A list of message numbers may be specified. Values of ‘0’ and ‘$’ in the list both mean the last message in the mailbox. For example:
    readmsg 1 3 0

    extracts three messages from the folder: the first, the third, and the last.

  3. Finally, the selection may be some text to match. This will select a mail message which exactly matches the specified text. For example,
    readmsg staff meeting

    extracts the message which contains the words ‘staff meeting’. Note that it will not match a message containing ‘Staff Meeting’ – the matching is case sensitive. Normally only the first message which matches the pattern is printed.

Unless one of the informational options is used, at least one command line argument must be present. Informational options are: --help (-?), --usage, and --version (-V).

3.8.1 Invocation of readmsg.


If a pattern is use for selection show all messages that match pattern by default only the first one is presented.


Display mailbox debugging information.

-f mailbox

Specified the default mailbox.


Show the entire header and ignore the weedlist.


Do not print the message header.


Put form-feed (Control-L) between messages instead of newline.

-w weedlist

A whitespace or coma separated list of header names to show per message. Default is --weedlist="From Subject Date To CC Apparently-".

See also Common Options.

3.8.2 Configuration of readmsg.

Following configuration statements affect the behavior of readmsg:

Readmsg Conf: header bool

If bool is ‘true’, display entire headers.

Readmsg Conf: weedlist str

Set the weedlist. The str argument is a string, containing a list of header names, separated by whitespace, commands or colons. This corresponds to the --weedlist command line option (see –weedlist).

Readmsg Conf: no-header bool

If bool is ‘true’, exclude all headers.

Readmsg Conf: form-feeds bool

If bool is ‘true’, output formfeed character between messages.

Readmsg Conf: folder url

Set the URL of the mailbox folder to read.

Readmsg Conf: show-all-match bool

If bool is ‘true’, print all messages matching pattern, not only the first.

debugSee Debug Statement.
tlsSee TLS Statement.
mailboxSee Mailbox Statement.
lockingSee Locking Statement.

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