Error Send E-mail RRS feed

  • Question

  • Dear All,

    I've problem send email with vb.net

    here my code :

    Dim mail As New MailMessage()
                Dim SmtpServer As New SmtpClient()

                mail.From = New MailAddress(senderEmail)
                mail.Subject = "Surbakti Billing"
                mail.Attachments.Add(New Attachment(filepath))
                mail.Body = emailBody
                SmtpServer.Host = "smtp.surbakti.net"
                SmtpServer.Port = 587
                SmtpServer.Timeout = 100000
                SmtpServer.ServicePoint.MaxIdleTime = 0


             Catch ex As Exception
                result = ex.ToString
            End Try
            Return result

    for 4 or 5 email there are no error, but I got error when the next email :

    System.Net.Mail.SmtpException: Service not available, closing transmission channel. The server response was: 4.7.0 Too many messages.
       at System.Net.Mail.MailCommand.CheckResponse(SmtpStatusCode statusCode, String response)

    the problem is after i got that error, next email will be send but after send 4 or 5 email i got that error again.

    send 4 or 5 email that error show, after that error, email will send 4 or 5 and got error again.

    what is that i missing or what must i do to fix that problem?

    thank you for anyhelp.



    Tuesday, September 4, 2012 2:32 AM


  • Your server is imposing a limit on the number of emails that can be sent for a SMTP connection.  This is typically done to prevent spamming.  You need to restrict the number of messages that you send at one time in order not to exceed this limit.  Or, you can ask the server administrator to adjust the limit.  Or you may be able to reconfigure your connection to the server to automatically disconnect and reconnect after every 5 (or whatever) emails.   It's a server problem rather than a programming problem, although you might be able to reconfigure your program to work around the restriction.

    • Marked as answer by Youen Zen Tuesday, September 18, 2012 8:13 AM
    Tuesday, September 4, 2012 3:12 AM