The Message property returns the complete message, including the headers. The MessageText property returns just the body of the message. However, you need to call the GetMessage method first to retrieve the message contents from the server. Very simple code using the ActiveX control would look something like this:
- Code: Select all
Dim nMessage As Long
Dim strMessage As String
For nMessage = 1 To InternetMail1.LastMessage
' Retrieve the message from the server
nError = InternetMail1.GetMessage(nMessage)
If nError = 0 Then
' Store the contents of the message in a string
strMessage = InternetMail1.Message
' Do something with the message
End If
Next
Basically you can just iterate through the available messages, call GetMessage to load the message into the control, and from there you can use the various properties to access parts of the message. Make sure you always check the return value from GetMessage.