views:

231

answers:

1

My problem is this: I need determine the timestamp of the first and last email sent from an Exchange account for every day that mail exists for. Also, for each day I need to rank the words that appear in each email so that I can report trend words for each day.

I have two approaches to this I'm considering, and would welcome comments and suggestions relating to either these approaches or something entirely different.

I've discounted exporting the file from Outlook as a CSV file as it does include the time stamp fields in the output, which is a crucial factor for me.

Approach #1 is:

Use Perl and Net::POP3 to pull the messages out of the inbox, mung them and then insert them into a MySQL database.

Approach #2 is:

Use Win32:OLE to attempt to act like a proper Exchange client, to the same end.

+1  A: 

If you use Win32::OLE you'll have to either use Outlook automation or the CDO libraries. I've done both in a previous life, and it works, but it's a bit painful.

I'd suggest approach #1 except that I can't imagine that Exchange would actually allow you to fetch sent mail through POP. Rather, though, Exchange can be enabled to expose an IMAP interface, and IMAP should certainly let you get at the Sent mail without running into any of the problems associated with POP (for example, replacing deleted messages on the server). I haven't used it but Mail::IMAPClient appears to be the recommended module for this.

Dan
Thanks for the suggestion. I have control of the Exchange server and we have both POP3 and IMAP connectors running. I initially considered POP3 as it is the simpler protocol. This is an, at very best, monthly task and can be written to be cumulative rather than parsing the whole lot each time.
sam_pointer
Are you sure Exchange will let you download Sent mail through POP3? I've never heard of that working.
Dan
No I am not, and you are more than likely right.
sam_pointer