The following is a proposal for several new actions, and an extension to the
"forward" action. We have customers that have expressed interest in these
features within our Sieve implementation, especially for the per-user Sieve
rules.
The extension to the "forward" action is the addtion of a ":file" argument:
Syntax: forward <addresses>
forward :file <file>
It should be possible to forward to multiple addresses. To make this
easy, the :file <file> argument causes the contents of <file> to be
used as a list of addresses. Each implementation MUST support a file
syntax of one RFC822 address per line. Impementations MAY support
multiple RFC822 addresses per line, separated with ";". Implementations
MUST support RFC822 comment syntax, including on otherwise empty lines
of text.
Action insert
Syntax: insert [:new] :header <header> <text>
insert :body <text>
insert :body :file <file>
The "insert" action inserts a line, or lines, of text as either a new
header or within the body. In either case, the "<text>" is one or
more lines of text inserted at the front of the header or body.
For "insert :header", if the <header> already exists within the message
header, it is renamed as "Old-<header>", and a new header is inserted,
with the value of <text>.
The ":new" argument, taking no arguments itself, causes the header field
to be inserted, without regard or affect to existing header fields of
the same name.
If ":file <file>" is given, then the text to insert within the body is
obtained by reading the "<file>".
Whether the text is obtained from a "<text>" argument, or by reading
the lines of text from a <file> argument, each implmentation SHOULD
support these variables within the text:
$NAME - the user portion of the current email address
$HOST - the hostname portion of the current email address
$SENDER - the address of the sender of the mail being filtered
$DATE - the original "Date:" field of the message being
filtered
$SUBJECT - the subject string, without leading "Re:" or "FW:"
strings.
Example:
if header ["To"] :contains "ietf-mta-filters" {
insert :header "X-Filed" "ietf"
fileinto "Lists/IETF"
keep
}
The above example will cause a new "X-Filed:" header to be inserted,
possibly causing any existing similarly-named headers to be renamed as
"Old-X-Filed:"
if header ["To", "Cc"] :contains "humor" {
insert :body "humor-leader.txt"
resend :file humor-list
}
This example is of a "poor man's" mailing list.
Action append
Syntax: append [:new] :header <header> <text>
append :body <text>
append :body :file <file>
The "append" action appends a line, or lines, of text to either a
(possibly new) header field, or to the body. In either case, the
"<text>" is one or more lines of text appended at the end of the
header or body.
If the ":new" argument is given, then header fields are inserted
without regard to, or affecting, an existing header field by the
same name.
The "append :header" action appends a header field to the header;
if the header field already exists, it is renamed as "Old-<header>".
The "append :body" action appends the given text to the end of
the body.
If ":file <file>" is given, then the text to append is obtained by
reading the "<file>".
For alternatives, please see the "insert" or "replace" actions.
Examples:
if header ["To"] :contains "ietf-mta-filters" and
not header ["X-Filed"] :contains "ietf" {
append :new :header "X-Filed: ietf"
fileinto "Lists/IETF"
keep
}
# implement a personal mailing list
if header ["To", "Cc"] :contains "humor" {
append :body "humor-leader.txt"
resend :file humor-list
}
Action replace
Syntax: replace :header <header> <text>
replace :body <text>
replace :body :file <file>
The "replace" action inserts a line, or lines, of text in either a
header field, or the body. In either case, the "<text>" is one or
more lines of text used to replace an existing header field or message
body. In the case of ":header", if the header field does not exist,
then it is appended at the end of the header.
The "replace :header" action replaces an existing header named <header>
with <text> or the contents of <file>. If the header doesn't already
exist, then the action is identical to "append".
The "replace :body" action appends the given text or file contents to
the end of the body.
If ":file <file>" is given, then the replacement text is obtained by
reading the "<file>".
For alternatives, please see the "insert" or "replace" actions.
Example:
if header ["To"] :contains "ietf-mta-filters" and
not header ["X-Filed"] :contains "ietf"
{
replace :header "X-Filed: ietf"
resend "Local-IETF-List"
}
Looking for comments!
--
Alan K. Stebbens <alan(_dot_)stebbens(_at_)software(_dot_)com>