Mailfromd |
|
General-Purpose Mail Filter |
Sergey Poznyakoff |
Mailfromd Manual (split by node): | ? |
A function is a named mailfromd
subroutine, which
takes zero or more parameters and optionally returns a certain
value. Depending on the return value, functions can be
subdivided into string functions and number functions.
A function may have mandatory and optional parameters.
When invoked, the function must be supplied exactly as many
actual arguments as the number of its mandatory parameters.
The function invocation syntax is:
name (args) |
where name is the function name and args is a comma-separated list of expressions. Summarizing, following are valid function calls:
foo(10) interval("1 hour") greylist("/var/my.db", 180) |
The number of parameters a function takes and their data types compose the function signature. When actual arguments are passed to the function, they are converted to the types of the corresponding formal parameters.
There are two major groups of functions: built-in functions,
that are implemented in the mailfromd
binary, and
user-defined functions, that are written in MFL. The
invocation syntax is the same for both groups.
Mailfromd
is shipped with a rich set of library
functions. In addition to these you can define your own functions.
In subsequent sections we will discuss the library and built-in functions, and then we will explain how to write new functions.
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.