New to custom hooks

Scott Fertig scott at
Sun Jan 24 00:17:30 CET 2016

I've gotten past my original issues, now I am much further along, I also forgot to mention that I am working with amavis 2.9. The remaining issue I have is that I am trying to get the body of the message if a subject matches a variable I have set in my custom hook. It appears that amavis tries to get the body based on this subject value but the output of this ends up being IO::File=GLOB(0x6a0ef70)

sub new {
  my($class,$conn,$msginfo) = @_;
  my($self) = bless {}, $class;
my($valuefrombody) = $msginfo->mail_text;
my($line); my($line_cnt) = 0;
my($ll) = 0;
do_log($ll,"CUSTOM: $valuefrombody");

The log reflects this as well and the value is being stored as IO::File=GLOB(0x6a0f528), I'm not quite sure what I'm overlooking to get this everything else appears to work as intended though.

Jan 23 09:55:06 mail amavis[2730]: (02730-01) CUSTOM: IO::File=GLOB(0x6a0f528)

----- Original Message -----
From: "Scott Fertig" <scott at>
To: "amavis-users" <amavis-users at>
Sent: Saturday, January 23, 2016 1:29:10 PM
Subject: New to custom hooks

Hello all,
I am sure you get questions like this all the time to the point of annoyance so I will try to keep this very short. I have tried searching for an answer during the last several days but all of my searches have lead to nowhere. Basically I am trying to learn more about the amavisd custom hooks and am trying to do some basic tests, however I feel like I may be missing something obvious that I do not know about. I have written a basic hook that does not really do anything as of yet, just simple use of get_header_body on the sender, subject, and to addresses, whenever I try to restart amavis I always get an error:

Starting amavisd...Error in config file "/etc/amavisd.conf": Error in config file "/etc/amavisd-SF.conf": Can't call method "get_header_field_body" on an undefined value at /opt/zimbra/conf/amavisd-SF.conf line 18, <DATA> line 751.

I have called a include: on the file amavisd-SF.conf in the amavisd configuration file.

The include is very small but this is the part it seems that it cannot get by:

package Amavis::Custom;
my($to) = $msginfo->get_header_field('to');
my($from) = $msginfo->get_header_field_body('from')

Am I perhaps missing a package or something else trivial? I feel like I am missing something basic like a import or defining a package, but I'm just not sure.

More information about the amavis-users mailing list