Difference between revisions of "Moderator"

From Mailutils
Jump to navigationJump to search
(Initial revision)
 
m
Line 37: Line 37:
 
     }
 
     }
 
</source>
 
</source>
 +
 +
[[Category:Sieve]]
 +
[[Category:Sieve Actions]]
 +
[[Category:Sieve Extensions]]

Revision as of 20:15, 17 December 2010

Moderator is a Sieve extension action, implementing a robot for Mailman-driven mail archives.

Mailman moderation request is a MIME message consisting of the three parts:

  1  text/plain      Introduction for the human reader.
  2  message/rfc822  Original submission.
  3  message/rfc822  Mailman control message.

Replying to part 3 while keeping the subject intact) instructs Mailman to discard the original submission.

Replying to part 3 while adding an Approved: header with the list password in it approves the submission.

Moderator is able to automatically discard messages, depending on the result of invoking an inferior Sieve program on this message.

Syntax

    moderator [:keep]
              [:address <address: string>]
              [:program <sieve-program: string>]
              [:source <sieve-file: string>]

The moderator action spawns an inferior Sieve machine and filters the original submission (part 2) through it. If the inferior machine marks the message as deleted, the action replies to the control message, thereby causing the submission to be discarded. The From: address of the reply can be modified using the :address tag. After discarding the message, moderator marks it as deleted, unless it is given the :keep tag.

If :source tag is given, its argument sieve-file specifies a Sieve source file to be used on the message. If :program tag is given, its argument supplies a Sieve program to be used on this message. Only one of :program or :source may be specified. Supplying them both, or supplying several instances of the same keyword, is an error. The action's behavior in this case is undefined.

If neither :program nor :source is supplied, moderator will create a copy of the existing Sieve machine and use it on the message.

The action checks the message structure: it will bail out if the message does not have exactly 3 MIME parts, or if parts 2 and 3 are not of type message/rfc822. It is the responsibility of the caller to make sure the message is actually a valid Mailman moderation request, for example:

   require "moderator";

   if allof(header :is "Sender" "mailman-bounces@gnu.org",
            header :is "X-List-Administrivia" "yes")
     {
        moderator :source "~/.sieve/mailman.sv";
     }