4

I would like to view email headers from the list of messages in a folder without opening the message first.

Is this possible?

3
  • So what is it you had in mind? You need to do this in Outlook, just at some point other than having the message open? What option does that leave? – user193661 Nov 26 '15 at 14:00
  • What particular headers do you want to see? – thims Nov 26 '15 at 14:18
  • In this instance, I wanted to check the originating mail server. In the past, I wanted to check for hints of spam before opening. Just seems a lot of clicks just to get to the mail header. – Andy Joiner Nov 26 '15 at 14:28
9

I personally put the button on Outlook Quick Access Toolbar (QAT). In order to do that, just click on the drop-down in the very upper left corner of Outlook window and select "More Commands...". In the "Customize Quick Access Toolbar" dialog, select "All Commands" in the "from" list and Add>> the "Message Options..." button to the right list. Click OK and you're there.

Now you can select the required message in the list and click this new button on QAT to show "Internet Headers".

2

Define a button to call the following VBA macro to display the header of the currently selected mail:

Public Sub mailHeaderView()
    Dim exp As Explorer
    Dim sel As Selection
    Dim please As String
    Dim s As String
    Dim mi As Outlook.mailItem
    Dim TransportMessageHeadersSchema As String

    ' https://social.msdn.microsoft.com/Forums/vstudio/en-US/e9342b09-02ba-441f-a824-5186bd9835a9/mailitemread-event?forum=outlookdev
    TransportMessageHeadersSchema = "http://schemas.microsoft.com/mapi/proptag/0x007D001E"

    Set exp = Application.ActiveExplorer

    If exp Is Nothing Then
      MsgBox "No Explorer!"
    Else
      Set sel = exp.Selection

      please = " Please select one Mail!"
      If sel Is Nothing Then
        MsgBox "No Selection!" & please
      ElseIf sel.count > 1 Then
        MsgBox "Multiple selection!" & please
      ElseIf sel.count < 1 Then
        MsgBox "No Selection!" & please
      ElseIf sel.item(1).Class <> olMail Then
        MsgBox "No Mail selected!" & please
      Else
        Set mi = sel.item(1)

        If mi Is Nothing Then
          MsgBox "No mail selected!"
        Else
            s = mi.PropertyAccessor.GetProperty(TransportMessageHeadersSchema)

            MsgBox s, vbInformation, "Mail Header"
        End If
      End If
    End If
End Sub

A similar macro is described here. Rather than opening a MsgBox, the mail header can be shown as mail or as text file via text editor or web browser.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.