hi,
i'm using ITH 3.3 and i try out the event-handle if a new email arrives in the inbox. this is code i use:
Public Sub Form1_MessagingItemCreated(ByVal sender As Object, ByVal e As MessagingItemEventArgs)
Dim ex As New EmailMessage(e.ItemId)
Dim subject As String
Dim body As String
Dim i As Integer
Dim notfall As Boolean
Dim id As String
Dim msg As EmailMessage
Application.DoEvents()
System.Threading.Thread.Sleep(1000)
Application.DoEvents()
subject = ex.Subject
For i = 0 To os.EmailAccounts(0).Inbox.Count - 1
msg = os.EmailAccounts(0).Inbox.Item(i)
If msg.Read = False Then
msg.Read = True
msg.Update()
subject = msg.Subject
body = msg.BodyText
writeLog("Form1_MessagingItemCreated", "Neue email eingegangen: " + subject + "|" + body, False)
writeLog("Form1_MessagingItemCreated", "Neue email eingegangen (ex): " + ex.Subject.ToString + "|" + ex.BodyText.ToString, False)
End If
Next
End Sub
important are the line writeLog. why? easy to explain: the results are different:
Neue email eingegangen: mySubject|myBodytext
and
Neue email eingegangen (ex): mySubject|
or sometimes:
Neue email eingegangen (ex): |
or in some cases:
Neue email eingegangen (ex): mySubject|myBodytext
so why are there 3 kinds of the result?
my workaround to get the incomming message take to long to get the messagedata :(
so are there any tips to get the whole message information without my workaround? why does the event not work correctly?
thanks.
hibbert.de