Determining which attachment is the stationary image(s) 
Author Message
 Determining which attachment is the stationary image(s)
Greetings,

I developed an addin that allows a person to save a message, including
attachments, into a in-house imaging solution.  I need to skip any
images sent as a part of the stationary.  Is there a way to determine
which images are part of the stationary?  If so, then how accurate is
the method?

Regards,

Steve



Sat, 25 Jun 2005 21:33:42 GMT  
 Determining which attachment is the stationary image(s)
You'll need to use the HTMLBody property for this, starting with the <body> tag, whose background attribute will give you the name of any stationery background image, e.g.:


lang=EN-US link=blue vlink=purple>

A check of the attachments for this message turns up a file named image001.gif.

You can assume that a background image is stationery. I don't think, however, that you can make the same assumption about any other image.
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
     Microsoft Outlook Programming: Jumpstart
     for Administrators, Power Users, and Developers
     http://www.slipstick.com/books/jumpstart.htm

Quote:

> Greetings,

> I developed an addin that allows a person to save a message, including
> attachments, into a in-house imaging solution.  I need to skip any
> images sent as a part of the stationary.  Is there a way to determine
> which images are part of the stationary?  If so, then how accurate is
> the method?

> Regards,

> Steve



Sat, 25 Jun 2005 22:12:43 GMT  
 Determining which attachment is the stationary image(s)
Sue,

Thank you for the reply.  I looked at the HTML source for an email.  I
used the "Holiday Letter" stationary which contains 3 images for the
stationary.  Below is the HTML for the message:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE></TITLE>
.. Style tag cut out

<META content="MSHTML 6.00.2600.0" name=GENERATOR></HEAD>

<DIV><FONT face='"Mead Bold"'></FONT>&nbsp;</DIV>
<P><FONT face=Arial><FONT size=2>Steve Besalk<SPAN
class=024591816-07012003>T</SPAN></FONT></FONT></P>
<DIV><FONT face=Arial><FONT size=2><SPAN
class=024591816-07012003></SPAN></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN
class=024591816-07012003></SPAN></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN class=024591816-07012003>This
is a
test....</SPAN></FONT></FONT></DIV>
<P><BR><FONT face=Arial size=2>Programmer / Analyst</FONT> <BR><FONT
face=Arial
color=#008000 size=2>COUNTRY<SUP>SM</SUP> Insurance and Financial
Services<SUP><B> </B></SUP></FONT><BR><FONT face=Arial size=2>Phone:
(309)
821-5175</FONT> <BR><FONT face=Arial size=2>Fax: (309) 821-4009</FONT>
</P><IMG

width=259
align=left> <IMG height=184 alt="Christams Trees"

<H2>Dear family and friends,</H2>
<P>Use this space for your message.</P><SPAN
id=_AthCaret></SPAN></BODY></HTML>

The filenames for the stationary images are

Santa Workshop.gif
Christmas Trees.gif
Holiday Letter Bkgrd.gif

Where your say the image name should be, I see a number.  Could this be
due to our current version of Outlook or the configuration?  We are
currently using Outlook 2000 SP1.  I do not know which version of
Exchange we are currently using, but I can find out.  Is there a
security setting that encripts the filenames in the HTML?

Steve

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Sun, 26 Jun 2005 06:57:26 GMT  
 Determining which attachment is the stationary image(s)

Quote:
> Where your say the image name should be, I see a number.  Could this be
> due to our current version of Outlook or the configuration?  We are
> currently using Outlook 2000 SP1.  I do not know which version of
> Exchange we are currently using, but I can find out.  Is there a
> security setting that encripts the filenames in the HTML?

Unfortunately, the way images are embedded varies by email client. My quick test earlier today was done with Outlook 2002.

However, since then, with the help of Dmitry Streblechenko (author of Outlook Spy and Redemption), I've learned how to tell whether an attachment is embedded or not, using a MAPI property on the attachment. The sample code below uses Redemption, but you could do something similar with CDO's Attachment.Fields collection. The key statement is:

    strCID = objSAtt.Fields(&H3712001E)

which returns the value of the content-ID for the attachment, if present. If that field is blank, then you know that the attachment is not embedded.

Note that this isn't a complete solution for your project, but it at least shows you how to distinguish an image or other attachment embedded in a message from a file that that the recipient explicitly sees as a distinct attachment. You'll also be able to match up attachments with the src= attributes in the source code.

Sub EnumAtts()
    Dim itm As Object
    Dim objSMail As Redemption.SafeMailItem
    Dim objSAtt As Redemption.Attachment
    Dim obj As Object
    Dim strCID As String
    On Error Resume Next

    Set itm = GetCurrentItem()
    If itm.Class = olMail Then
        Set objSMail = CreateObject("Redemption.SafeMailItem")
        objSMail.Item = itm
        For Each objSAtt In objSMail.Attachments
            ' get the content-ID for the attachment,
            ' with will be blank if the attachment is not embedded
            strCID = objSAtt.Fields(&H3712001E)
            If strCID = "" Then
                strCID = "not embedded"
            End If
            Debug.Print objSAtt.filename, strCID
        Next
    End If

    Set objSAtt = Nothing
    Set itm = Nothing
End Sub

Function GetCurrentItem() As Object
    Dim objApp As Outlook.Application

    Set objApp = CreateObject("Outlook.Application")
    On Error Resume Next
    Select Case TypeName(objApp.ActiveWindow)
        Case "Explorer"
            Set GetCurrentItem = objApp.ActiveExplorer.Selection.Item(1)
        Case "Inspector"
            Set GetCurrentItem = objApp.ActiveInspector.CurrentItem
        Case Else
            ' anything else will result in an error, which is
            ' why we have the error handler above
    End Select

    Set objApp = Nothing
End Function

The newsgroup interface at Developersdex (http://www.developersdex.com) does not automatically quote the text of the original message when you post a reply. Please take the time to quote the original message manually so that people reading your current response can understand what you're talking about. Otherwise, you may not receive the answer you're looking for.
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
     Microsoft Outlook Programming: Jumpstart
     for Administrators, Power Users, and Developers
     http://www.slipstick.com/books/jumpstart.htm

Quote:

> Sue,

> Thank you for the reply.  I looked at the HTML source for an email.  I
> used the "Holiday Letter" stationary which contains 3 images for the
> stationary.  Below is the HTML for the message:

> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML><HEAD><TITLE></TITLE>
> .. Style tag cut out

> <META content="MSHTML 6.00.2600.0" name=GENERATOR></HEAD>

> <DIV><FONT face='"Mead Bold"'></FONT>&nbsp;</DIV>
> <P><FONT face=Arial><FONT size=2>Steve Besalk<SPAN
> class=024591816-07012003>T</SPAN></FONT></FONT></P>
> <DIV><FONT face=Arial><FONT size=2><SPAN
> class=024591816-07012003></SPAN></FONT></FONT>&nbsp;</DIV>
> <DIV><FONT face=Arial><FONT size=2><SPAN
> class=024591816-07012003></SPAN></FONT></FONT>&nbsp;</DIV>
> <DIV><FONT face=Arial><FONT size=2><SPAN class=024591816-07012003>This
> is a
> test....</SPAN></FONT></FONT></DIV>
> <P><BR><FONT face=Arial size=2>Programmer / Analyst</FONT> <BR><FONT
> face=Arial
> color=#008000 size=2>COUNTRY<SUP>SM</SUP> Insurance and Financial
> Services<SUP><B> </B></SUP></FONT><BR><FONT face=Arial size=2>Phone:
> (309)
> 821-5175</FONT> <BR><FONT face=Arial size=2>Fax: (309) 821-4009</FONT>
> </P><IMG

> width=259
> align=left> <IMG height=184 alt="Christams Trees"

> <H2>Dear family and friends,</H2>
> <P>Use this space for your message.</P><SPAN
> id=_AthCaret></SPAN></BODY></HTML>

> The filenames for the stationary images are

> Santa Workshop.gif
> Christmas Trees.gif
> Holiday Letter Bkgrd.gif



Sun, 26 Jun 2005 10:45:38 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. How do I determine what version of VBA I am using

2. determine which DOS screen I am on

3. I am Looking for certain ico. type images

4. <IMG> link to encoded image attachment

5. .htmlbody reference to an image attachment

6. Macro for picking up stationary

7. automating outlook to use custom stationary

8. Multiple stationary

9. Adding dynamic data to vCard, or stationary?

10. Macro for picking up stationary

11. Stationary

12. Urgent Help With Outlook2000 Stationary Needed

 

 
Powered by phpBB® Forum Software