aboutsummaryrefslogtreecommitdiff
path: root/doc/mailfromd.texi
diff options
context:
space:
mode:
Diffstat (limited to 'doc/mailfromd.texi')
-rw-r--r--doc/mailfromd.texi98
1 files changed, 96 insertions, 2 deletions
diff --git a/doc/mailfromd.texi b/doc/mailfromd.texi
index 731c4ae1..95c6741f 100644
--- a/doc/mailfromd.texi
+++ b/doc/mailfromd.texi
@@ -223,2 +223,3 @@ Built-in and Library Functions
223* System functions:: 223* System functions::
224* Sieve Interface::
224* Interfaces to Third-Party Programs:: 225* Interfaces to Third-Party Programs::
@@ -987,3 +988,2 @@ the corresponding section below.
987@cindex Upgrading from 4.1 to 4.2 988@cindex Upgrading from 4.1 to 4.2
988@UNREVISED{}
989 Upgrading to this version does not require any special efforts. You 989 Upgrading to this version does not require any special efforts. You
@@ -5260,2 +5260,3 @@ in version @value{VERSION}.
5260* System functions:: 5260* System functions::
5261* Sieve Interface::
5261* Interfaces to Third-Party Programs:: 5262* Interfaces to Third-Party Programs::
@@ -6479,4 +6480,97 @@ the return status of the command otherwise.
6479@end deftypefn 6480@end deftypefn
6480
6481 6481
6482@node Sieve Interface
6483@subsubsection Sieve Interface
6484@cindex Sieve
6485@UNREVISED{}
6486 @samp{Sieve} is a powerful mail filtering language, defined in
6487@acronym{RFC} 3028. @command{Mailfromd} supports an extended form
6488of this language. For description of the language and available
6489extensions, @xref{Sieve Language, Sieve Language, Sieve Language,
6490mailutils, GNU Mailutils Manual}.
6491
6492@deftypefn {Built-in Function} boolean sieve (string @var{script} @
6493 [, number @var{flags}])
6494Compile the Sieve source file @var{script} and execute it over the
6495collected message. This function can be used only in @code{eom}
6496handler.
6497
6498@findex sieve.mfh
6499Optional @var{flags} define additional debugging and verbosity
6500settings. It is a bit-mask field, consisting of a bitwise @code{or}
6501of one or more of the following flags, defined in @file{sieve.mfh}:
6502
6503@table @code
6504@item MF_SIEVE_LOG
6505Log every executed @samp{Sieve} action.
6506
6507@item MF_SIEVE_DEBUG_TRACE
6508Trace execution of @samp{Sieve} tests.
6509
6510@item MF_SIEVE_DEBUG_INSTR
6511Log every instruction, executed in the compiled @samp{Sieve} code.
6512This produces huge amounts of output and is rarely useful, unless you
6513suspect some bug in @samp{Sieve} implementation and wish to trace it.
6514
6515@item MF_SIEVE_DEBUG_MAILUTILS
6516Log debugging information about the underlying Mailutils calls.
6517
6518@item MF_SIEVE_DEBUG_PROT
6519Trace networking protocols.
6520@end table
6521
6522For example, @code{MF_SIEVE_LOG|MF_SIEVE_DEBUG_TRACE} enables logging
6523@samp{Sieve} actions and tests.
6524
6525The @code{sieve} function returns @code{true} if the message was
6526accepted by the @var{script} program, and @code{false} otherwise.
6527Here, the word @dfn{accepted} means that some form of @samp{KEEP}
6528action (@pxref{Actions, keep, Actions, mailutils, GNU Mailutils
6529Manual}) was executed over the message.
6530@end deftypefn
6531
6532The following example discards each message not accepted by the
6533@samp{Sieve} program @file{/etc/mail/filter.siv}:
6534
6535@smallexample
6536#include_once <sieve.mfh>
6537group eom
6538do
6539 if not sieve("/etc/mail/filter.siv", MF_SIEVE_LOG)
6540 discard
6541 fi
6542done
6543@end smallexample
6544
6545The example below illustrates how one can adjust logging flags
6546depending on the current debugging level:
6547
6548@smallexample
6549#include_once <sieve.mfh>
6550prog eom
6551do
6552 number flags 0
6553 number level debug_level("bi_sieve")
6554 if %level >= 1
6555 set flags %flags | MF_SIEVE_LOG
6556 fi
6557 if %level >= 2
6558 set flags %flags | MF_SIEVE_DEBUG_TRACE
6559 fi
6560 if %level > 9
6561 set flags %flags | MF_SIEVE_DEBUG_INSTR
6562 fi
6563 if %level > 19
6564 set flags %flags | MF_SIEVE_DEBUG_MAILUTILS
6565 fi
6566 if %level > 20
6567 set flags %flags | MF_SIEVE_DEBUG_PROT
6568 fi
6569
6570 if not sieve("/etc/mail/filter.siv", %flags)
6571 discard
6572 fi
6573done
6574@end smallexample
6575
6482@node Interfaces to Third-Party Programs 6576@node Interfaces to Third-Party Programs

Return to:

Send suggestions and report system problems to the System administrator.