SYNOPSIS
link mailio
record message(from,header,body)
procedure readmail(f)
procedure writemail(msg,f)
DESCRIPTION
Readmail reads the file given as an argument (or standard input by
default) and returns a message record.
The from field is the first line of the message. The header field is a
table where the entry values are the header keywords (such as Date and
Subject), and the assigned values are the remainder of the header line
with leading spaces trimmed. The body field is a list of the lines of
the message. Note that readmail maintains an internal one-line buffer,
so you should not try and mix calls of readmail with other input from
the same file.
Writemail takes a message record and writes it to the specified file
(or standard output by default).
EXAMPLES
To copy every message from standard input to standard output:
while writemail(readmail())
To write just the first lines and Subject headers (if present) from a
mail folder:
while msg := readmail do {
write(msg.from)
write(\msg.header["Subject"])
write
}
SEE ALSO
getmail(1), mailtrim(1), mp(1), classify(1)
BUGS
Header lines which are repeated in a message (such as Received) will
have all but the last occurrences silently removed. It is hoped this
restriction will be removed, at the expense of a change in the format
of the message record, at a later date.
Sun UK North 15 Oct 1987 MAILIO(3)
Man(1) output converted with
man2html