General-Purpose Mail Filter
Body modification is an experimental feature of MFL. The version 8.7 provides only one function for that purpose.
Replace the body of the message with text. Notice, that text must not contain RFC 822 headers. See the previous section if you want to manipulate message headers.
replbody("Body of this message has been removed by the mail filter.")
No restrictions are imposed on the format of text.
Replaces the body of the message with the content of the stream fd. Use this function if the body is very big, or if it is returned by an external program.
Notice that this function starts reading from the current position in
rewind if you wish to read from the beginning of
The example below shows how to preprocess the body of the message using external program /usr/bin/mailproc, which is supposed to read the body from its standard input and write the processed text to its standard output:
number fd # Temporary file descriptor prog data do # Open the temporary file set fd tempfile() done prog body do # Write the body to it. write_body(fd, $1, $2) done prog eom do # Use the resulting stream as the stdin to the
mailproc# command and read the new body from its standard output. rewind(fd) replbody_fd(spawn("</usr/bin/mailproc", fd)) done
This document was generated on January 3, 2019 using makeinfo.Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.