Extracting text from archived Outlook messages
In an Outlook folder, I store hundreds of messa开发者_如何学Pythonges about the status of a battery system. The emails are automatically sent daily. Each message contains information on the battery voltage in the message body, and the information is always formatted as follows,
DATE: 9/14/2011 Main Battery Voltage [V]: 25.67I would like to write a routine to extract the battery voltage and date information from each message body and concatenate the results so I get a vector of [date, voltage]. I'd like the routine to run from the command line, rather than using Outlook. What is the right tool for this task? Are Outlook messages in a specific folder saved as ASCII files somewhere? If that is the case, I could easily open all the files using perl or similar tool and pull the information out. I just don't know how and where the message body information is stored.
Convert your Outlook message store into a standard formats like Maildir or Mbox first, then employ Email::Folder
or Mail::Box
for the parsing.
If you want to bypass Outlook entirely, you could use IMAP::Client
or somesuch to fetch the mail directly from the server. Depending on how Outlook was configured, existing messages may or may not be there, but it'll work for all new messages, anyway.
精彩评论