Hello,

Trying to get heads and tails of Mimedefang and Perl, I'm stuck understanding 
why the below code in Mimedefang will only match on the first line of an email 
and ignore the rest.

So:
"open something anotherthing thirdthing" only matches if on the first line of 
the email, and additional lines are ignored.
I'm trying to match all occurrences of lines with this pattern and add headers 
accordingly.
Can anybody throw me a bone on this one?

###########################################################################
sub filter {
        my($entity) = @_;
        
        if (grep {/email\@example\.com/i} @Recipients) {
                my $io;
                if ($io = $entity->open("r")) {
                        while (defined($_ = $io->getline)) {
                                if  ( $_ =~ 
/\bopen\W+([a-z]+)(\W+)?([a-z]+)?(\W+)?([a-z]+)?/i) {
                                        action_add_header('X-header',"$1, $3, 
$5");
                                        last;   
                                }
                        }
                $io->close;
                }
        }
}
###########################################################################

All the best

Lars Sorensen

_______________________________________________
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list [email protected]
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang

Reply via email to