Differentiating file attachments from inline attachments in Exchange

Peter Green peter.n.green at gmail.com
Thu Nov 5 17:13:53 CET 2009


I am trying to write some code that will scan an Exchange 2003
mailbox, detach file attachments from messages into the file system
and replace them in the message with links. My initial attempt is
based on Tim Golden's approach at
http://timgolden.me.uk/python/win32_how_do_i/replace-outlook-attachments-with-links.html,
using CDO.

A typical message may contain AutoCAD drawings, PDFs, site photographs
and Excel spreadsheet schedules as separate file attachments, together
with inline graphics such as a corporate logo in the signature. The
problem is that iterating over the message attachments using CDO
detaches *everything*. I want to leave the inline images in the
message body.

I've looked at the CDO documentation and cannot see any property that
distinguishes inline images from file attachments. I suspect I am
barking up the wrong tree and need to be automating Outlook instead,
but if so, any suggestions as to how I can achieve what I want? I
imagine Content-Disposition Headers are going to be involved
somehow...

Thanks in advance,

Peter



More information about the Python-list mailing list