Imports Redemption
Private Sub CheckExchangeEmail()
Const olFolderInbox As Redemption.rdoDefaultFolders = 6
Dim Session As New Redemption.RDOSession
Dim objFolder As Redemption.RDOFolder
Dim oItems As Object
Dim oItem As Redemption.RDOMail
Dim sMessageBody As String
Do
Try
Session.LogonExchangeMailbox("username@mycompany.com", "myexchangeserver.com")
objFolder = Session.GetDefaultFolder(olFolderInbox)
oItems = objFolder.Items
For Each oItem In oItems
If (oItem.UnRead) Then
'Do whatever you need this for
sMessageBody = oItem.Body
oItem.MarkRead(True)
End If
Next
Catch ex As Exception
Session = Nothing
Finally
If Not IsNothing(Session) Then
If Session.LoggedOn Then
Session.Logoff()
End If
End If
End Try
Loop
End Sub