Stripping attachments from sent emails

B

Bill

I would like to write a VBA tool to strip attachments from emails in Sent
Items. The goal is to clean up mailboxes of users who email many large
attachments (a policy is eventually on its way). However, I cannot seem to
differentiate between an "external" attachment like a Word document and a
small bitmap image (e.g., screen capture) embedded into the body of the
email for illustrative purposes.

I would like to leave embedded images intact and strip what I'm calling
"true" attachments.

Is there any way to differentiate between them?

My code looks at objItem.Attachments.Count and then calls Remove( ).

But the first message it fired on as I tested had only a small embedded
graphic.

I could test for items with Size > (some-number) but that's rather
unsatisfying.

Thanks for any ideas,

Bill Le May
 
D

Dmitry Streblechenko

Embedded HTML images have PR_ATTACH_CONTENT_ID property set. HTML body
refers to these images in the <img src="cid:xyz"...> tag (where xyz is the
value of the PR_ATTACH_CONTENT_ID).
You can access that property using Extended MAPI, CDO 1.21 or Redemption
(but not the Outlook Object Model).

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
B

Bill

Dmitry Streblechenko said:
Embedded HTML images have PR_ATTACH_CONTENT_ID property set. HTML body
refers to these images in the <img src="cid:xyz"...> tag (where xyz is the
value of the PR_ATTACH_CONTENT_ID).
You can access that property using Extended MAPI, CDO 1.21 or Redemption
(but not the Outlook Object Model).

Thank you for your reply. I have Redemption, but I am uncertain how to
access this property. If I cycle through the Attachments in a SafeMailItem,
how would I determine whether they have this property set? My goal is to
delete only the non-embedded attachments.

Thanks,

Bill Le May
 
D

Dmitry Streblechenko

You can access them using Attachment.Fields(PR_ATTACH_CONTENT_ID) where
PR_ATTACH_CONTENT_ID is 0x3712001e

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top