Ask Leo!

accessing embedded versus "real" attachments

Home
««   »»

From Leo's mailbag:

> From: A Computer User
> Sent: October 10, 2006
> To: Ask Leo!
> Subject: accessing embedded versus "real" attachments
>
> Leo,
> I've written a C# program to find all of the email with
> attachments so I can take the images and push them to a
> server to process them as if they came in as a fax (these are
> tif images).
>
> The problem I'm having is I can't tell if something is a real
> attachment or an embedded attachment. How can I can the
> difference? Headers are different depending on which mail
> server sends the email and I really want to just look at
> emails that have the attachment icon.
>
> Looking at this in a completely different way, is it possible
> to add a plug-in to Outlook that would allow me to have my
> users click a button inside Outlook if they wanted to take
> the attchments from that email and forward them to the server?
>
> What I'm dealing with here are two sides of the coin: how to
> grab the valid attachments from an email and the interface
> for the user like a "Send attachments to Server" option/button.

Well, I can't see q way to tell the difference in a cursory
exam. I looked at the attachment object in an Outlook macro
and as far as I can tell they're the same, whether it's embedded
or attached. You could start building some rules of thumb, I suppose
(if plain text email, for example, it MUST be an attachment - maybe
some rules based on scanning the content for tags in HTML
mail), but beyond that ... not sure.

It's not that hard to grab the attachments in a macro (which
should use the same object model as C#). Here's a macro I have
that dumps all the embedded images (and, in fact, also dumps all
the attachments if there are any):

Sub SaveImageAttachment()
Dim objCurrentItem As Outlook.MailItem
Dim colAttachments As Outlook.Attachments
Dim objAttachment As Outlook.Attachment

Set objCurrentItem = Application.ActiveInspector.CurrentItem
Set colAttachments = objCurrentItem.Attachments

For Each objAttachment In colAttachments
objAttachment.SaveAsFile ("C:\" & objAttachment.FileName)
Next

Set objAttachment = Nothing
Set colAttachments = Nothing
objCurrentItem.Close (olDiscard)
Set objCurrentItem = Nothing

End Sub

Not sure if that helps, or if you're already past that point.
Anyway, I just have that Macro tied to a button on the toolbar
when reading a message.

Hope it helps a little...

Thanks for asking,

Leo

Article 1438 | Category: EMail

Google
ask-leo.com
Web


Entire site Copyright © 2003-2009, Puget Sound Software, LLC
Terms, Conditions & Privacy