[EMAIL PROTECTED] wrote: > Hi All, > I know that Microsoft Exchange has a com interface, CDO, but I can't seem to > find one for Microsoft outlook. > does anyone have code snippets for using msoutlook and python, or > suggestions?
You can use CDO to manage your Inbox, send mail etc. The following functions navigate to a certain folder and parse every message text for a certain regular expression: def spamstat (): s = Dispatch ("Mapi.Session") s.Logon ("Default Outlook Profile") junk = findJunk (s) rex = re.compile ('The ([0-9]+) emails listed below') for msg in junk.Messages: text = msg.Text match = rex.search (text) if match: date = parseDate (msg.TimeSent) print (date, int (match.group (1))) def findJunk (s): inbox = s.Inbox for folder in s.Inbox.Folders: if folder.Name == 'Junk': return folder See the Spambayes Outlook plugin (http://spambayes.sourceforge.net/) for a complex example. Daniel -- http://mail.python.org/mailman/listinfo/python-list