| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
It is important to understand that conditional expressions choose the first match. To illustrate this, lets suppose you need to store values of all recipients from the envelope in the ‘X-Also-Delivered-To’ header. A naive way to do so is:
if command [rcpt to:] = "(.*)" add header [X-Also-Delivered-To] "\1" fi |
However, this will store only the very first RCPT TO value, so
you will not achieve your goal.
To help you in this case, anubis offers a
concatenation operator, whose effect is to concatenate the
values of all requested keys prior to matching them against the
regular expression. Syntactically, the concatenation operator is a
string enclosed in parentheses, placed right after the key part of a
condition. This string is used as a separator when concatenating
values. For example:
if command [rcpt to:] (",") = "(.*)"
add header [X-Also-Delivered-To] "\1"
fi
|
This fragment will first create a string consisting of all RCPT
TO addresses, separated by a comma, and then will match it against
the regular expression on the right hand side. Since this expression
matches any string, the ‘\1’ will contain a comma-separated list
of addresses.
This document was generated by Sergey Poznyakoff on December, 20 2008 using texi2html 1.78.