Question : Send Email Error : Transport failed to connect to the server

I have a code which sends NewsLetter to the users. Below is the code.

Dim objEmail as New MailMessage
sBody = "This is our test email to you"
objEmail.Subject="This is my Subject"
Dim MySQL as string = "Select Name, email from TestMail"
Dim MyConn As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings("YourConfigSettings"))
Dim objDR as SQLDataReader
Dim Cmd as New SQLCommand(MySQL, MyConn)
MyConn.Open()
objDR=Cmd.ExecuteReader(system.data.CommandBehavior.CloseConnection)

While objDR.Read()
      sEmail = objDR("email")
      objEmail.To =sEmail
      objEmail.FROM="fromYou@YourDomain.com"
      objEmail.Body=sBody & vbcrlf & "Name: " & objDR("Name") & vbcrlf & "Email: " & sEmail
      objEmail.BodyFormat = MailFormat.Text
      SmtpMail.SmtpServer ="mail.YourDomain.com"
      SmtpMail.Send(objEmail)
      lblEmails.text+=sEmail & "
"
End While
MyConn.Close

Above in TestMail table there more than 1000 users. While loop is generating error "transport failed to connect to the server" after sending around 100 emails.

I am running this code on public server using ASP.NET (VB.NET).

What can be the reason for this and solution for same. Please help

Answer : Send Email Error : Transport failed to connect to the server

The best way is to ask your service provider for news letter sending email facility.
Random Solutions  
 
programming4us programming4us