NewMailEx Only provides First e-mail in inbox

  • Thread starter Thread starter ben
  • Start date Start date
B

ben

When using NewMailEx to get a list of received e-mails, EntryIDCollection
will only return the very first e-mail received, even if 10-15 e-mails come
in at the same time.

This is my code in it's entirety.


Private Sub Application_NewMailEx(ByVal EntryIDCollection As String)
Dim arr() As String
Dim i As Integer
Dim m As MailItem
On Error Resume Next
arr = Split(EntryIDCollection, ",")
For i = 0 To UBound(arr)
Set m = Application.Session.GetItemFromID(arr(i))
MsgBox m.Subject
Next
End Sub


Or am I going at this backwards, does (Will return a list of all e-mails
that have arrived since this event last fired) mean that if I receive 5
e-mails, the first one will trigger.. but the next time I receive an e-mail
the previous 4 , plus the one just in will trigger? And if so, won't that
leave a few e-mails always in limbo?
 
Don't use a MsgBox to test any kind of automatic processing, because it's
modal and will stop execution while the box is displayed. Use Debug.Print
instead.

If you're working with an Exchange account in cached mode, NewMailEx will
fire for every single item received, so you'll see only one entry ID each
time. In online mode, it will return multiple items, but may skip a small
number under extremely heavy loads.
 
Sue,

Thank you, that was precisely the problem. Changed my code to mark all
incoming messages as read for testing, and worked like a charm. I was a
little lost because all the examples I found used MsgBox for testing.
 
Back
Top