title: Extracting Embedded Images From Outlook Email
body: <p>I am using Microsoft's CDO (Collaboration Data Objects) to programmatically read mail from an Outlook mailbox and save embedded image attachments.  I'm trying to do this from Python using the Win32 extensions, but samples in any language that uses CDO would be helpful.</p>
  
  <p>So far, I am here...</p>
  
  <p>The following Python code will read the last email in my mailbox, print the names of the attachments, and print the message body:</p>
  
  <pre><code>from win32com.client import Dispatch
  
  session = Dispatch('MAPI.session')
  session.Logon('','',0,1,0,0,'exchange.foo.com\nbar');
  inbox = session.Inbox
  message = inbox.Messages.Item(inbox.Messages.Count)
  
  for attachment in message.Attachments:
      print attachment
  
  print message.Text
  
  session.Logoff()
  </code></pre>
  
  <p>However, the attachment names are things like: "zesjvqeqcb_chart_0".  Inside the email source, I see image source links like this:
  &lt;IMG src="cid:zesjvqeqcb_chart_0"&gt;</p>
  
  <p>So, is it possible to use this CID URL (or anything else) to extract the actual image and save it locally?</p>