smtpmail.send fails after 30 or so emails

  • Thread starter Thread starter Ben Dilts
  • Start date Start date
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 );
 
You may be overloading the SMTP server (If it is local or on your local net,
check the event logs). The default SMTP setting may be too restrictive for
the volume you are pushing through. Make sure if you do open up the flood
gates that you restrict access of some spammer will find it and relay the
s**t out of you and that will not make you well liked but the recipients of
that trash.

Tom

--
==========================================
= Tom Vande Stouwe MCSD.net, MCAD.net, MCP
= 45Wallstreet.com (www.45wallstreet.com)
= (803)-345-5001
==========================================
= If you are not making any mistakes
..= ..you are not trying hard enough.
==========================================
 
Back
Top