Bingo ! This works....

Yes, score=x tag=x tag2=x kill=x tests=[], quarantine 80-Pz4e3GWP0 
(spam-quarantine)

Mark... Thank you for this little piece of code...This is going to save 
us a lot of extra work...
I did not know that removing the "#use strict" line was a bad thing... I 
have done that some other times in other perl scripts... (Won't happen 
again ;-)

Thanks....

P.S.
can you also use this with other custom lines in the header ?
Our provider puts also a : X-Spam-Flag: YES
is the header. Can you also test for that ?

Greetings... Richard

Mark Martinec wrote:
> Chris, Richard,
> 
>> I am trying to do the same thing as Richard and seeing similar results.
>> When I detect a custom 'spam' header, I set the option to
>> bypass_spam_checks using the code sample you provided, but I think that if
>> spam checks are completely bypassed, then so are all of the actions that
>> can be taken as a result of detecting spam.  Setting CC_SPAM doesn't seem
>> to have any effect if bypass_spam_checks is set.
> 
> I don't know, it does work here, so there must be something different
> between our setups.
> 
>>From a Richard's log the key entry is:
> 
> Jul 29 16:17:39 mxt2 amavis[28334]: (28334-02) do_notify_and_quar:
>   ccat=Clean (1,0) ("1":Clean, "0":CatchAll, "0":CatchAll) ccat_block=(),
>   q_mth=, qar_mth=
> 
> which indicates the contents category CC_SPAM (=6) was not set.
> 
> My log shows:
> 
> Jul 31 17:59:49. ... amavisd[75930]: (75930-01) do_notify_and_quar:
>   ccat=Spam (6,0) ("6":Spam, "1":Clean, "0":CatchAll) ccat_block=(),
>   q_mth=local:W%P/spam/%m.gz, qar_mth=local:archive/%m.gz
> 
> So my primary suspect was that the custom hook didn't do anything,
> although Richard assured the regexp matched (regarding space
> after a colon).
> 
> I'd like to first see that the custom hook did what it was supposed
> to do. Perhaps adding a log entry there could help us move forward:
> 
> package Amavis::Custom;
> use strict;
> 
> BEGIN {
>   import Amavis::Conf qw(:platform :confvars c cr ca);
>   import Amavis::Util qw(do_log);
> }
> 
> # invoked at child process creation time;
> # return an object, or just undef when custom checks are not needed
> sub new {
>   my($class,$conn,$msginfo) = @_;
>   my($self) = bless {}, $class;
>   my($subj) = $msginfo->get_header_field_body('subject');
>   do_log(2, "CUSTOM1 (magicspam), subj=%s", $subj);
>   if ($subj =~ /^[ \t]*\*\*SomeMagicSpamTag\*\*/) {
>     do_log(2, "CUSTOM2 (magicspam) YES");
>     $msginfo->spam_report("Upstream MTA labeled message as spam");  # header
>     $msginfo->spam_summary("Upstream MTA labeled message as spam"); # 
> multiline
>     $msginfo->add_contents_category(CC_SPAM,0);
>     for my $r (@{$msginfo->per_recip_data}) {
>       $r->add_contents_category(CC_SPAM,0);
>       $r->bypass_spam_checks(1);
>     }
>   }
>   $self;  # returning an object activates further callbacks,
>           # returning undef disables them
> }
> 1;  # insure a defined return
> 
> 
> 
> Hmmm, now I see why Richard has commented-out the "use strict",
> this masked the problem - the CC_SPAM was not declared in the
> Amavis::Custom module!
> 
>   Mark
> 
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> AMaViS-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/amavis-user
> AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3
> AMaViS-HowTos:http://www.amavis.org/howto/

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
AMaViS-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/amavis-user
AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3
AMaViS-HowTos:http://www.amavis.org/howto/

Reply via email to