Clear questions and runnable code
get the best and fastest answer
So from the sounds of this, and from my above comment that "print Dumper $mail;" results in showing only the 'mail_inet_body' is getting populated - with both the headers and the body... I'm guessing that my file is not formatted properly.
So that leads me to ask if that is a factor of Exchange, or a factor of my code?
I have an EventSink setup to save out every incoming message to a temp file, and then run SpamAssassin on that file, outputting a temp file that says whether it is spam or not.
That output file is then scanned to see if the mail is spam or not, and is then marked accordingly and sent on to the user, as well as saving out the orig copy of the mail to either a SPAM or NONSPAM directory.
I'm not sure what I might have done to broken the format - but it sounds like the issue is that it doesn't like the format the file is in.
So perhaps the secondary question is if there is perhaps a different/better/easier way to do this?
I have two folders full of mail, one spam, one ham. I want to iterate over that folder and open each message - initially I was using Email::Find to scan the entire message for e-mail addresses and pulling out the ones that had our domain in them. That way I can say user XYZ gets 35 spam in a day, and 245 ham.
But this doesn't work if there is a long chain of reponses to an e-mail that is documented in the body of the message - then the same user's address might show up many times in the same message. So user XYZ might look like they get 30 ham messages a day, when in reality they were only getting one message with many back and forth responses that built up a tree of addresses in the body and that triggered their score.
So what I want is only to look at the To, Cc, and the Bcc fields of the headers and look for users there.
I figured this was the easiest method, but perhaps there is one that is better?
Or is there a way I can find out how my message is no longer formatted properly to the RFC822 format? Since I am on a Windows platform, does saving it out (as a txt file) then add in \r with the \n and therefore break it?
There are some odd things afoot now, in the Villa Straylight.