Article ID: 194870
Article Last Modified on 5/19/2005
Private Sub Form_Load()
Dim oSession As MAPI.Session
Dim oFolder As Folder
Dim oMsgColl As Messages
Dim oMessage As Message
' Logon to the MAPI session
Set oSession = New MAPI.Session
oSession.Logon
' Get the Inbox folder and its message collection.
Set oFolder = oSession.GetDefaultFolder(CdoDefaultFolderInbox)
Set oMsgColl = oFolder.Messages
' Search through the messages in the Inbox for the Internet
' message. Then use the CdoPR_TRANSPORT_MESSAGE_HEADERS
' (&H7D001E) property tag to retrieve the Internet header.
' If the property doesn't exist(Not a Internet message) you will
' receive a MAPI_E_NOT_FOUND error.
For Each oMessage In oMsgColl
If oMessage.Subject = "Test Internet message" Then
MsgBox oMessage.Fields(&H7D001E) 'Display the header
End If
Next
' Logoff and cleanup
oSession.Logoff
Set oSession = Nothing
Set oMessage = Nothing
Set oMsgColl = Nothing
Set oFolder = Nothing
End Sub
178073 How To Obtaining the SMTP Header for a MAPI Message
87022 SMTP: Definition of SMTP
Additional query words: Internet
Keywords: kbhowto kbmsg KB194870