Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 111845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T02:27:04+00:00 2026-05-11T02:27:04+00:00

I am using Microsoft’s CDO (Collaboration Data Objects) to programmatically read mail from an

  • 0

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.

So far, I am here…

The following Python code will read the last email in my mailbox, print the names of the attachments, and print the message body:

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() 

However, the attachment names are things like: ‘zesjvqeqcb_chart_0’. Inside the email source, I see image source links like this: <IMG src=’cid:zesjvqeqcb_chart_0′>

So, is it possible to use this CID URL (or anything else) to extract the actual image and save it locally?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T02:27:04+00:00Added an answer on May 11, 2026 at 2:27 am

    Difference in versions of OS/Outlook/CDO is what might be the source of confusion, so here are the steps to get it working on WinXP/Outlook 2007/CDO 1.21:

    • install CDO 1.21
    • install win32com.client
    • goto C:\Python25\Lib\site-packages\win32com\client\ directory run the following:
    python makepy.py
    • from the list select ‘Microsoft CDO 1.21 Library (1.21)’, click ok
    C:\Python25\Lib\site-packages\win32com\client>python makepy.py Generating to C:\Python25\lib\site-packages\win32com\gen_py\3FA7DEA7-6438-101B-ACC1-00AA00423326x0x1x33.py Building definitions from type library... Generating... Importing module
    • Examining file 3FA7DEA7-6438-101B-ACC1-00AA00423326x0x1x33.py that’s just been generated, will give you an idea of what classes, methods, properties and constants are available.

    Now that we are done with the boring steps, here is the fun part:

    import win32com.client from win32com.client import Dispatch  session = Dispatch('MAPI.session') session.Logon ('Outlook') # this is profile name inbox = session.Inbox messages = session.Inbox.Messages  message = inbox.Messages.GetFirst()  if(message):     attachments = message.Attachments     for i in range(attachments.Count):         attachment = attachments.Item(i + 1) # yep, indexes are 1 based          filename = 'c:\\tmpfile' + str(i)         attachment.WriteToFile(FileName=filename) session.Logoff() 

    Same general approach will also work if you have older version of CDO (CDO for win2k)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 78k
  • Answers 78k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer If you data is not totally free format, I would… May 11, 2026 at 3:48 pm
  • added an answer Did this even compile under a recent g++? I tried… May 11, 2026 at 3:48 pm
  • added an answer The reason you get that error is that the default… May 11, 2026 at 3:48 pm

Related Questions

I am using Microsoft Access 2007 to move and massage some data between two
I am using Microsoft Visual Web Developer 2008 Express. I've made an ASP.NET MVC
I am using Microsoft's CDO (Collaboration Data Objects) to programmatically read mail from an
I am using the webbrowser control in winforms and discovered now that background images
I am using Context.RewritePath() in ASP.NET 3.5 application running on IIS7. I am doing

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.