I would like to view email headers from the list of messages in a folder without opening the message first.
Is this possible?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.
Sign up to join this communityI would like to view email headers from the list of messages in a folder without opening the message first.
Is this possible?
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".
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.