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 (
http://perl.oreilly.com/news/perladmin_0700.html) 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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.