Today I will show you how to solve problem in send message when you host with hosting provider. This is the error message:

The SMTP server requires a secure connection or the client was not authenticated. The server response was: host5.vdconline.vn ESMTP MailEnable Service, Version: 5.51-- denied access at 02/03/12 02:45:26

Please try this solution below:

Public Shared Sub SendEmail(  


    Dim Message As New Net.Mail.MailMessage() 

    Dim FromEmail As New Net.Mail.MailAddress(“From Email Address”)
    Message.From = FromEmail
    Message.To.Add(“To Email Address”)  


    Message.Subject = “Subject of the Email”
    Message.Body = “Body of the Email”
    ‘Message.SubjectEncoding = System.Text.Encoding.UTF8
    ‘Message.BodyEncoding = System.Text.Encoding.UTF8
    ‘Message.IsBodyHtml = False
    ‘Message.Priority = Net.Mail.MailPriority.High 

    Dim SmtpClient As New Net.Mail.SmtpClient(“smtp.YourEmailServer.com”, PortNo eg: 587 for gmail )
    SmtpClient.EnableSsl = True
    ‘smtp.DeliveryMethod = Net.Mail.SmtpDeliveryMethod.Network
    ‘smtp.UseDefaultCredentials = False 

SmtpClient.Credentials = New Net.NetworkCredential(“YourEmailAddress”, “YourEmailPassword”

    SmtpClient.Send(Message)  


End Sub

Note: An important point to note is that you have to set the EnableSSl to True before you set the NetWork Credentials of your SMTP client.