Next: , Previous: , Up: Message functions   [Contents][Index]


5.19.2 Message body functions

Built-in Function: number message_body_size (number nmsg)

Return the size, in bytes, of the body of message nmsg. See the note to the message_size, above.

Built-in Function: number message_body_lines (number nmsg)

Return number of lines in the body of message referred to by descriptor nmsg.

Built-in Function: void message_body_rewind (number nmsg)

Rewind the stream associated with the body of message referred to by descriptor nmsg.

A call to message_body_read_line (see below) after calling this function will return the first line from the message body.

Built-in Function: string message_read_body_line (number nmsg)

Read and return next line from the body of the message nmsg. If there are no more lines to read, raise the eof exception.

Use message_body_rewind (see above) to rewind the body stream and read its contents again.

Built-in Function: void message_body_to_stream (number fd, number nmsg; string filter_pipe)

Copies the body of the message nsmg to stream descriptor fd. The descriptor must be obtained by a previous call to open.

Optional filter_pipe supplies a sequence of Mailutils filters, through which the data will be passed before writing them to fd. See Filtering functions, for a discussion of filter pipe syntax.

In addition to filters described in See Filters, two special filters are provided for use with this function: mimedecode and charset. The mimedecode filter instructs the function to decode the message body by reverting the encoding specified by its Content-Transfer-Encoding header. It is normally used as the very first filter in chain. The charset filter recodes the message body from it original character set to the character set specified as its argument.

See mimedecode, for a detailed discussion of this feature.


Next: , Previous: , Up: Message functions   [Contents][Index]