How to always log attachment name?

Benning, Markus ich at markusbenning.de
Thu Apr 23 08:02:44 CEST 2015


Am 2015-04-22 18:26, schrieb Andrew Clayton:
> For a banned attachment I get the following logged
> 
>     (05889-01) Attachment (application/octet-stream,.asc,test.exe.scr)
> 
> However for a clean one I just get
> 
>     (05890-01) Attachment ()
> 
> I've been trawling through the amavisd Perl script but am having
> trouble locating where the decision to provide the attachment details 
> or
> not is made.
> 
> Any pointers would be appreciated.

Hi Andrew,

the F macro is defined in %builtins:
-- amavisd line 12176
     F => sub { my $b;
                # first banned part name with a comment from a rule 
regexp
                for my $r (@{$MSGINFO->per_recip_data}) {
                  $b = $r->banning_reason_short;
                  last  if defined $b;
                }
                $b },
--

It just logs the first banned attachment.

You can add a new macro and get the info from 
$MSGINFO->mime_entity->parts.
mime_entity should be a MIME::Entity object (MIME::Parser):

http://search.cpan.org/~dskoll/MIME-tools-5.506/lib/MIME/Entity.pm


  Markus

-- 
Markus Benning, https://markusbenning.de/


More information about the amavis-users mailing list