atom feed3 messages in net.sourceforge.lists.courier-usersRe: [courier-users] Perlfilter debugging
FromSent OnAttachments
Alexey MishustinJun 29, 2014 7:28 am 
Sam VarshavchikJun 29, 2014 8:15 am 
Alexey MishustinJun 29, 2014 8:41 am 
Subject:Re: [courier-users] Perlfilter debugging
From:Sam Varshavchik (mrs@courier-mta.com)
Date:Jun 29, 2014 8:15:53 am
List:net.sourceforge.lists.courier-users

Alexey Mishustin writes:

Hello,

I'm trying to implement a simple perl-filter script:

diff -u /usr/share/courier/perlfilter-example.pl ./perlfilter-mailerdaemon.pl --- /usr/share/courier/perlfilter-example.pl 2014-06-22 14:35:24.000000000 +0400 +++ ./perlfilter-mailerdaemon.pl 2014-06-29 18:16:47.000000000 +0400 @@ -17,6 +17,11 @@ # The number of the filedescriptor that's connected to the socket is # passed to us on STDIN.

+my $debug_fh; +open ($debug_fh, '>', '/tmp/perldebug'); +print $debug_fh "perlfilter script launched!\n"; +close $debug_fh; + my $filedesc=shift @ARGV;

my $socket=new IO::File "+<&$filedesc"; @@ -77,7 +82,7 @@ last if $line eq ""; # End of headers

return "500 Invalid Date header." - if $line =~ /^Date:......................................................................../i; + if $line =~ /^To:.*mailer-daemon.*$/i; }

return "";

But it doesn't work: doesn't reject messages sent to mailer-daemon, doesn't print into the file /tmp/perldebug. Nothing about perlfilter in logs (except 'Starting perlfilter').

There is the sole line with the full path to the script in /etc/courier/filters/perlfilter.

There is the sole line 'esmtp' in /etc/courier/enablefiltering.

I issued `courierfilter start' and `filterctl start perlfilter'.

lsof shows sockets of perlfilter, ps aux shows processes.

How could I debug this?

You probably need to set perlfilter-mode to "all", since you're not using maildrop filters.

------------------------------------------------------------------------------ Open source business process management suite built on Java and Eclipse Turn processes into business applications with Bonita BPM Community Edition Quickly connect people, data, and systems into organized workflows Winner of BOSSIE, CODIE, OW2 and Gartner awards http://p.sf.net/sfu/Bonitasoft