python and outlook

Tim Golden tim.golden at
Fri Oct 21 10:46:36 CEST 2005


> Are there any links or sites on how to read outlook mail boxes or
address book?

Easiest thing to probably to automate the Outlook COM object or a MAPI
for CDO access. You can do this easily with the pywin32 extensions.

You can then use pretty much any published example from around the net.

Example (to print the subject of each item in the inbox):

import win32com.client

outlook = win32com.client.gencache.EnsureDispatch
namespace = outlook.GetNamespace ("MAPI")
inbox = namespace.GetDefaultFolder
for i in range (inbox.Items.Count):
  message = inbox.Items[i+1]
  print message.Subject


This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:

More information about the Python-list mailing list