Hacking amavisd $msginfo

Sahil Tandon sahil at FreeBSD.org
Tue Jun 14 01:54:43 CEST 2011

On Mon, 2011-06-13 at 15:30:22 -0400, Alex wrote:

> I'm trying to modify amavisd-new-2.6.4 to write specific headers to
> syslog when a spam is found, and I believe utilizing the $msginfo
> header in mail_to_local_mailbox is the proper way to do this. This
> function appears to have all the information about the spam message,
> including the quarantined file's name.
> I'm somewhat of a beginning perl programmer, so I'm really not sure
> how to do this. How can I access the individual elements of the
> $msginfo structure? Where are they defined?

Have you looked at the amavisd-custom.conf that is bundled with
amavisd-new for examples?

> I've tried variations of trying to access the hash, but I don't think
> I'm doing it properly:
>    my ($my_subject) = $msginfo->get_header_field('subject');
> What is the proper way to access the actual list of recipients, and
> not (apparently?) a pointer to it?
>   my $loc_recips = $msginfo->recips;
>   do_log(0,"loc recips: $loc_recips");
> I realize this is probably a basic perl problem, but I hoped to learn
> more about perl and amavis, and thought this was a fun project for me.
> Ideas greatly appreciated.

Show the entire code (instead of tidbits) in which you try to access the
contents of $msginfo.

Sahil Tandon <sahil at FreeBSD.org>

More information about the amavis-users mailing list