B
Ben Dilts
I'm doing something along the lines of the following code:
Dim rTo As Recipient
For Each rTo In m_To
Dim Msg As New MailMessage
Msg.From = m_From
Msg.Cc = m_CC
Msg.Bcc = m_BCC
Dim a As MailAttachment
For Each a In m_Attach
Msg.Attachments.Add(a)
Next
Msg.To = rTo.Email
Msg.Subject = m_Subject
Msg.Body = m_Body
Try
lbProgress.Items.Add("Sending to " & rTo.FullName)
SmtpMail.Send(Msg)
lbProgress.Items.Add("Succeeded.")
Catch ex As Exception
lbProgress.Items.Add("FAILED: " & ex.Message)
End Try
Next
It works wonderfully for a while, but then hangs before it
gets all the way through the list (if the list is long).
After a matter of MINUTES, I get the following exception:
Could not access 'CDO.Message' object.
Then (once I catch the exception), it continues working
through the list, emailing fine. What could cause this
error?
I've tried moving the "dim Msg as new MailMessage" outside
of the loop, but it didn't help.
Any ideas?
~BenDilts( void );
Dim rTo As Recipient
For Each rTo In m_To
Dim Msg As New MailMessage
Msg.From = m_From
Msg.Cc = m_CC
Msg.Bcc = m_BCC
Dim a As MailAttachment
For Each a In m_Attach
Msg.Attachments.Add(a)
Next
Msg.To = rTo.Email
Msg.Subject = m_Subject
Msg.Body = m_Body
Try
lbProgress.Items.Add("Sending to " & rTo.FullName)
SmtpMail.Send(Msg)
lbProgress.Items.Add("Succeeded.")
Catch ex As Exception
lbProgress.Items.Add("FAILED: " & ex.Message)
End Try
Next
It works wonderfully for a while, but then hangs before it
gets all the way through the list (if the list is long).
After a matter of MINUTES, I get the following exception:
Could not access 'CDO.Message' object.
Then (once I catch the exception), it continues working
through the list, emailing fine. What could cause this
error?
I've tried moving the "dim Msg as new MailMessage" outside
of the loop, but it didn't help.
Any ideas?
~BenDilts( void );