#### 5.7.2 External Actions ¶

GNU Mailutils is shipped with a set of external Sieve actions. These actions are compiled as loadable modules and must be required prior to use (see Require Statement).

Action: moderator `[:keep] [:address address(string)] [:source sieve-file(string)] [:program sieve-text(string)]` ¶

  Synopsis:

      require "moderator"
      moderator args;

  Description: This action is a moderator robot for Mailman-driven mail archives. A Mailman moderation request is a MIME message consisting of the following three parts:

  N | Content-Type | Description
  --- | --- | ---
  1 | text/plain | Introduction for the human reader.
  2 | message/rfc822 | Original submission.
  3 | message/rfc822 | Mailman control message.

  Replying to part 3 (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.

  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 `:address` tag. After discarding the message, `moderator` marks it as deleted, unless it is given `:keep` tag.

  If the `:source` tag is given, its argument specifies a Sieve source file to be used on the message. Otherwise, if `:program` is given, its argument supplies a Sieve program to be used on this message. At most one of these tags may be specified. Supplying them both, or supplying several instances of the same tag, is an error. The behavior of the action in this case is undefined.

  If neither `:program` nor `:source` is given, `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 ‘`message/rfc822`’ type. It is the responsibility of the caller to make sure the message is actually a valid Mailman moderation request (see the example below).

  Example:

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

Action: pipe `[:envelope] [:header] [:body] command(string)` ¶

  Synopsis:

      require "pipe";

      pipe command

  Description: The `pipe` action executes a shell command specified by its argument and pipes the entire message (including envelope) to its standard input. When given, tags `:envelope`, `:header`, and `:body` control what parts of the message to pipe to the command.

  Example: The example below uses the `putmail` utility (see putmail) to forward the message to user ‘`gray`’ on the machine ‘`mail.gnu.org`’.

      require "pipe";

      pipe "/usr/bin/putmail smtp://gray@mail.gnu.org"

Action: vacation `[:days ndays(number)] [:subject subject(string)] [:aliases addrlist(string-list)] [:noreply noreply-address(string-list)] [:reply_regex expr(string)] [:reply_prefix prefix(string)] [:sender email(string)] [:database path(string)] [:return_address email(string)] [:header headers(string-list)] [:mime] [:always_reply] [:rfc2822] [:file] text(string)` ¶

  Syntax:

      require "vacation";
      vacation args;

  Description: The `vacation` action returns a message with text to the sender. It is intended to inform the sender that the recipient is not currently reading his mail.

  If the `:file` tag is present, text is treated as the name of the file to read the body of the reply message from. When used together with tag `:rfc2822`, the file should be formatted as a valid RFC 2822 message, i.e. headers followed by empty line and body. Headers may not contain ‘`To`’, ‘`From`’, and ‘`Subject`’, as these will be generated automatically.

  If the `:subject` tag is given, its argument sets the subject of the message. Otherwise, the subject is formed by prefixing original subject with ‘`Re:`’, or the prefix given with the `:reply_prefix` tag. Before prefixing, any original prefixes matching extended regular expression expr (`:reply_regex` tag) are stripped from the subject line. If `:reply_regex` is not specified, the default regexp is ‘`^re: *`’.

  Another headers can be added using the `:header` tag. Its argument is a list of header strings, each one having the form ‘`"name:value"`’. Additional whitespace is allowed on both sides of the colon.

  The `:aliases` tag instructs `vacation` to handle messages for any address in addrlist in the same manner as those received for the user’s principal email.

  Before processing, `vacation` compares the sender address with its address exclusion list. Elements of this list are extended case-insensitive regular expressions. If the sender address matches any of these expressions, the message will not be replied. The default exclusion list is:

          .*-REQUEST@.*
          .*-RELAY@.*
          .*-OWNER@.*
          ^OWNER-.*
          ^postmaster@.*
          ^UUCP@.*
          ^MAILER@.*
          ^MAILER-DAEMON@.*

  New entries can be added to this list using `:noreply` tag.

  The `:days` tag sets the reply interval. A reply is sent to each sender once in ndays days. GNU Sieve keeps track of sender addresses and dates in file `.vacation` stored in the user’s home directory. The file name can be changed using the `:database` tag.

  The tag `:always_reply` instructs vacation to respond to the message regardless of whether the user email is listed as a recipient for the message.