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

Alex via amavis-users amavis-users at amavis.org
Tue May 13 01:24:56 CEST 2014


Hi Mark,

On Tue, May 6, 2014 at 6:48 PM, Mark Martinec <Mark.Martinec at ijs.si> wrote:

> 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}));
>

I eventually figured out that $msginfo->per_recip_data is available, and
was able to do the following:

        my $r = @{$msginfo->per_recip_data}[0];
        my $score = $r->spam_level;

Does $score now not contain the value of X-Spam-Score?

It seems like I'm still missing something. I believe the latest
amavisd-custom example file still includes references to using
$msginfo->spam_level and not the $msginfo->per_recip_data.

Thanks,
Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.amavis.org/pipermail/amavis-users/attachments/20140512/a2c7d091/attachment.html>


More information about the amavis-users mailing list