[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
It is important to understand that conditional expressions choose the first match. To illustrate this, lets suppose you wish to store all recipient emails 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 containing all RCPT
TO
addresses, separated by commas, and then 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.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on January 6, 2024 using texi2html 5.0.