Mailfromd |
|
General-Purpose Mail Filter |
Sergey Poznyakoff |
Mailfromd Manual (split by node): | ? |
‘Sieve’ is a powerful mail filtering language, defined in
RFC 3028. Mailfromd
supports an extended form
of this language. For a description of the language and available
extensions, See Sieve Language: (mailutils)Sieve Language section `Sieve Language' in GNU Mailutils Manual.
Compile the Sieve source file script and execute it over the
collected message. This function can be used only in eom
handler.
Optional flags define additional debugging and verbosity
settings. It is a bit-mask field, consisting of a bitwise or
of one or more of the following flags, defined in ‘sieve.mfh’:
MF_SIEVE_LOG
Log every executed ‘Sieve’ action.
MF_SIEVE_DEBUG_TRACE
Trace execution of ‘Sieve’ tests.
MF_SIEVE_DEBUG_INSTR
Log every instruction, executed in the compiled ‘Sieve’ code. This produces huge amounts of output and is rarely useful, unless you suspect some bug in ‘Sieve’ implementation and wish to trace it.
MF_SIEVE_DEBUG_MAILUTILS
Log debugging information about the underlying Mailutils calls.
MF_SIEVE_DEBUG_PROT
Trace networking protocols.
For example, MF_SIEVE_LOG|MF_SIEVE_DEBUG_TRACE
enables logging
‘Sieve’ actions and tests.
The sieve
function returns true
if the message was
accepted by the script program, and false
otherwise.
Here, the word accepted means that some form of ‘KEEP’
action (see keep: (mailutils)Actions section `Actions' in GNU Mailutils Manual) was executed over the message.
The following example discards each message not accepted by the ‘Sieve’ program ‘/etc/mail/filter.siv’:
#include_once <sieve.mfh> group eom do if not sieve("/etc/mail/filter.siv", MF_SIEVE_LOG) discard fi done |
The example below illustrates how one can adjust logging flags depending on the current debugging level:
#include_once <sieve.mfh> prog eom do number flags 0 number level debug_level("bi_sieve") if %level >= 1 set flags %flags | MF_SIEVE_LOG fi if %level >= 2 set flags %flags | MF_SIEVE_DEBUG_TRACE fi if %level > 9 set flags %flags | MF_SIEVE_DEBUG_INSTR fi if %level > 19 set flags %flags | MF_SIEVE_DEBUG_MAILUTILS fi if %level > 20 set flags %flags | MF_SIEVE_DEBUG_PROT fi if not sieve("/etc/mail/filter.siv", %flags) discard fi done |
Mailfromd Manual (split by node): | ? |
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.