Can't locate object method spam_level using Amavis::In::Message

Mark Martinec via amavis-users amavis-users at amavis.org
Wed May 7 00:48:48 CEST 2014


Alex,

> I've migrated from an older version of amavisd to amavisd-2.8.1 on fc20 
> and
> now having a problem with a custom config that worked with the previous
> version.
> 
> I'm trying to use the spam_level() function and it looks like it's now 
> in
> the Amavis::In::Message::PerRecip package. I'm receiving the following
> error and unable to figure out how to provide access to this function 
> in my
> custom config:
> 
> Apr 17 16:37:59 mail01 amavis[3657]: (03657-03) (!)custom before_send
> error: Can't locate object method "spam_level" via package
> "Amavis::In::Message" at /etc/amavisd/amavisd-custom.conf line 118.

Indeed, the spam_level() is now a property of a recipient because in
a multi-recipient mail message with some per-recipient score 
contributions
like penpals, each recipient may come up with somewhat different spam 
score.

> My custom config looks like this:
[...]
> my($loc_level) = $msginfo->spam_level;

You need to walk through all recipients of a mail message and collect
each score. As a summary value perhaps a max or a min value (or 
something
in-between) may still be useful. Perhaps:

   my($min_spam_level, $max_spam_level) =
     Amavis::Util::minmax(map($_->spam_level,
                              @{$msginfo->per_recip_data}));


Mark



More information about the amavis-users mailing list