I have an application that sends emails through an smtp server at a
hosting company. It is attempting to send 100 messages, but after 15,
I get an error back:
Unable to read data from the transport connection:
After that, I'm unable to send any messages for 5 minutes or so.

The support at the ISP has written back:
Also, with server side security there is a rule that states if an SMTP
connection is opened more than 10 times in a 20 minute block of time
it will block the IP temporarily to avoid a Denial of Service (DOS)

You will want to modify your code to open a single SMTP connection,
send all of the messages, then close the SMTP connection to avoid
receiving the timeout error.

I think I'm already doing this. I create the smtp object once, send a
bunch of emails and then close the class.
Is there some setting that I'm missing? or another way to do this?
Thanks in advance,

Below is the code

Imports System.Net.Mail
Public Class Emailer
Private mSMTP As SmtpClient

Public Sub New(ByVal pstrSMTP As String)

mSMTP = New SmtpClient(pstrSMTP)
mSMTP.Credentials = New System.Net.NetworkCredential("uname",

End Sub

Public Sub SendEmail(ByVal pstrFrom As String, ByVal pstrTo As
String, ByVal pstrSubject As String, ByVal pstrBody As String)

Dim oMM As New MailMessage(pstrFrom, pstrTo)

With oMM
.Body = pstrBody
.Priority = MailPriority.Normal
.Subject = pstrSubject
End With


oMM = Nothing

End Sub

End Class


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question