emansouri has asked for the wisdom of the Perl Monks concerning the following question:

Hello there,

I am hoping you can provide me a bit of help with something related to Mail::Audit::Attach.

I have all the methods of Mail::Audit working exactly as I need them to, except those pertaining to attachments.

For instance in the simple code example below, I simply cannot get the num_attachments to properly display. It always shows 0 no matter how many attachments are really affixed to each message:

#!/usr/local/bin/perl use Mail::POP3Client; use Mail::Audit qw(Attach); my $pop=new Mail::POP3Client(USER => $username, PASSWORD => $password, HOST => $host, AUTH_MODE => "PASS"); for( my $i = 1; $i <= $pop->Count(); $i++ ) { my @msg = $pop->Retrieve($i); filter(@msg); } $pop->Close(); sub filter { my @data=@_; my $mail = Mail::Audit->new(data => \@data, noexit => 1); print $mail->num_attachments."\n"; }

20040206 Edit by Corion: Fixed formatting, added (correct) code tags

Replies are listed 'Best First'.
Re: mail::audit::attach
by ysth (Canon) on Feb 06, 2004 at 08:55 UTC
    It may be that the attachments you are working with are not well-formed. Turn on logging with the loglevel or log parameters to Mail::Audit->new, and see if you are getting an "encountered error during parse" error.