use Log::Dispatch::File;
use POSIX qw(strftime WEXITSTATUS WIFEXITED);
+# If a filter set's header is $MAGIC_TO_TOKEN, that set is compared
+# against headers matching this regex (taken from procmail).
+my $MAGIC_TO_REGEX = '^((Original-)?(Resent-)?(To|Cc|Bcc)|(X-Envelope |Apparently(-Resent)?)-To)';
+my $MAGIC_TO_TOKEN = ' TO';
+
=head1 OPTIONS
=over 4
@filter = @$filterref;
$header = shift(@filter);
+ # Handle filters using the magic TO header specially.
+ if ($header eq $MAGIC_TO_TOKEN) {
+ foreach $header (keys(%headers)) {
+ if ($header =~ /$MAGIC_TO_REGEX/i) {
+ foreach $contents (@{$headers{lc($header)}}) {
+ foreach $pair (@filter) {
+ ($match, $expression) = @$pair;
+ if ($contents =~ /$match/) {
+ return $expression;
+ }
+ }
+ }
+ }
+ }
+
+ # Now that it's been processed specially, skip normal handling.
+ continue;
+ }
+
# Walk the list of message headers matching the filter's
# specified header.
foreach $contents (@{$headers{lc($header)}}) {
that some have priority over others. XXX: get Doug to write an
example of having the same header matched more than once.
+Lastly, B<minc> supports a magic ' TO' header. Filters using this
+header are matched against a collection of headers related to (and
+including) the To. Which headers to use is determined by a regular
+expression borrowed from procmail.
+
=head1 EXAMPLES
@FILTERS = (