I am trying to send a message (8k) to a list ofcontacts held in a Public Folder. I use the AdvancedSearch facility to select the list of recipients. All has worked fine until we move the mailbox from Exchange 5.5 to Exchange 2003: now, after about 250 messages sent I get the error 0x80004005 - Operation failed. I first thought it had to do with the PublicFolder but in fact it fails on the "oMessage.Copy" statement.
This is an extract of my code:
Set oSearch = SearchObject
Set oItems = oSearch.Results
NumItems = oItems.Count
On Error Resume Next
For I = 1 To NumItems
sName = Trim(Cstr(oItems(I).Email1Address))
Set oMailMsg = oMessage.Copy
If Len(sName) > 0 Then
Set oRecipient = .Recipients.Add(sName)
oRecipient.Type = olTo
If .Recipients.Count > 0 Then
.DeleteAfterSubmit = True
If Err.Number = 0 Then
LogInfo "Mail sent to : " & sName
LogInfo "Mail NOT sent to: " & oItems(I).FullName & " (Error:" & Hex(Err.Number) & " - " & Err.Description & ")"
Set oRecipient = Nothing
Set oMailMsg = Nothing
bSearchComp = True 'this is the variable I test in the main loop to quit the program when all processing done.
Any help will be greatly appreciated.