Results 1 to 3 of 3
  1. #1
    asak
    Guest

    Outlook Field Headers (2k)

    I interested in creating a field header in my Inbox that tells me the message format of the mails that I recieve (plain text,RTF,HTML or Word). I can't find an existing field but feel that I'm not the only one out there that would like to know the HTML mails I recieve and have the choice not to preview them???

    Thanks for any help,

    Alex.

  2. #2
    5 Star Lounger
    Join Date
    May 2001
    Location
    Washington, USA
    Posts
    750
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Outlook Field Headers (2k)

    The code snip below shows one way to determine the mail type. It's not quite what you want. Because it runs under the Open event, it uses the Inspector. You'll need to code throught the Explorer path, which I haven't looked at. I suspect you'll want to do this via a com add-in so that the code runs at the application level.

    If objmailitem.GetInspector.EditorType = 2 Then ' It's HTML

    If anyone's interested, below are some code blocks from an add-in we use that converts HTML mail to plain text when a mail item is opened. I've commented in lines that check to see if there is embedded script. You could just convert mail that runs j or vb script rather than converting all HTML mail.


    Private Sub objMailItem_Open(Cancel As Boolean)
    Dim strHTLM As String

    If objmailitem.GetInspector.EditorType = 2 Then ' It's HTML

    MsgBox "This is an html item"

    ' Test for script tags since this is an HTML mail item
    If InStr(1, objmailitem.HTMLBody, "<Script", 1) > 0 Or InStr(1, objmailitem.HTMLBody, "<Object", 1) > 0 Then
    MsgBox "this puppy has script"

    ' Convert from HTML since it has script
    ' objmailitem.Body = objmailitem.HTMLBody
    ' objmailitem.Save

    End If

    End If

    End Sub

    Private Sub Application_Startup()
    Set objinspectors = Application.Inspectors
    End Sub
    Private Sub objInspectors_NewInspector(ByVal Inspector As Inspector)
    Set objinsp = Inspector
    If objinsp.CurrentItem.Class = olMail Then
    Set objmailitem = objinsp.CurrentItem
    End If
    End Sub

    Private Sub objmailitem_Read()
    Dim strHTLM As String

    If objmailitem.GetInspector.EditorType = 2 Then ' It's HTML

    MsgBox "This is an html item"

    ' Test for script tags since this is an HTML mail item
    If InStr(1, objmailitem.HTMLBody, "<Script", 1) > 0 Or InStr(1, objmailitem.HTMLBody, "<Object", 1) > 0 Then
    MsgBox "this puppy has script"

    ' Convert from HTML since it has script
    ' objmailitem.Body = objmailitem.HTMLBody
    ' objmailitem.Save

    End If

    End If
    End Sub

  3. #3
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Roanoke area, Virginia, USA
    Posts
    3,729
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Outlook Field Headers (2k)

    personally, it's easier to use (zaphtml) to strip html to begin with.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •