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

I have recently hacked at Exchange 2000/2003 to make SpamAssassin work with it via an EventSink, obviously on a Win32 platform.

Now that I have it working, I want to run some stats on the amount of spam that each user is getting.

The code I have written to run the stats all works... sort of - I narrowed down my issue to the issue being with the Mail::Internet code. I looked around on PerlMonks as well as on O'Reilly ( and found various usage examples.

When I try the code that I have below as an example (in "readmore" tags), I just get no response at all. No errors, but no output either (if I add in print statements in there just to see if they are getting hit, they do - just nothing that is related to the Mail::Internet. And yes, there are definitely a lot of files in that directory that it is trying to read, and it is seeing them.).

I am on Win2K SP3, running ActiveState Perl (v5.6.1). If I run PPM and do a query Mail, I get:
Email-Find (0.09) Find RFC 822 email addresses in plain text
Email-Valid (0.14) Check validity of Internet email addresses
MailTools (1.58) Various Mail related modules

are there known issues with MailTools under Win32? or am I doing anything obviously wrong in the code below?
use strict; use Mail::Internet; use Mail::Header; #variable declaration my $strSpamDir = 'D:/spam/SPAM_FINAL'; my $file; my $mail; opendir SPAM_DIR, $strSpamDir or die "could not opendir $strSpamDir:$! +\n"; foreach $file (readdir SPAM_DIR){ if($file ne '.' && $file ne '..'){ open(MY_FILE, "$strSpamDir/$file") or die "could not open the +file $strSpamDir/$file:$!\n"; $mail = Mail::Internet->new(\*MY_FILE); $mail->print_header(); close(MY_FILE) or die "could not close $strSpamDir/$file:$!\n" +; } } closedir SPAM_DIR;

There are some odd things afoot now, in the Villa Straylight.