EDIT: I'll add that the domain is hosted by Web.com. Perhaps someone else uses them and has experienced something similar.
The code below is set up for both my own smtp server and gmail. Both fail for different reasons. I'm writing this in VS 2010/.Net 4
When I send from my own domain smtp server I receive no exceptions I just never send any email. I have tried sending from different accounts to different accounts. There are no exceptions, is just never gets delivered. I changed my password and did receive and authentication error, which seems to prove I had the credentials correct. I am following my domain hosts instructions for domain name and port.
With gmail I get the error, "The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more at". I read about this and followed the links to allow less secure devices to access my gmail. I received the confirmation email from gmail indicating I had made the changes for less secure email, but I still get the same error.
I have read and tried everything at the following links and can't get past this.
http://ithoughthecamewithyou.com/post/sending-email-via-gmail-in-cnet-using-smtpclient
c# SmtpClient class not able to send email using gmail
http://blogs.msdn.com/b/mariya/archive/2006/06/15/633007.aspx
When looking at the code I am using, does anything jump out at you and being not right? Is there a property set wrong or am I missing a Property?
Public Shared Sub SendMailMessage(ByVal sfrom As String, ByVal recepient As String, ByVal bcc As String, ByVal cc As String, ByVal subject As String, ByVal body As String)
Try
Dim mMailMessage As New MailMessage()
mMailMessage.From = New MailAddress(sfrom)
mMailMessage.To.Add(New MailAddress(recepient))
If Not bcc Is Nothing And bcc <> String.Empty Then
mMailMessage.Bcc.Add(New MailAddress(bcc))
End If
If Not cc Is Nothing And cc <> String.Empty Then
mMailMessage.CC.Add(New MailAddress(cc))
End If
mMailMessage.Subject = subject
mMailMessage.Body = body
mMailMessage.IsBodyHtml = True
mMailMessage.Priority = MailPriority.Normal
'GMAIL
'Dim mSmtpClient As New SmtpClient()
'mSmtpClient.DeliveryMethod = SmtpDeliveryMethod.Network
'mSmtpClient.UseDefaultCredentials = True
'mSmtpClient.EnableSsl = True
'mSmtpClient.Host = "smtp.gmail.com"
'mSmtpClient.Port = 587
'mSmtpClient.Credentials = New System.Net.NetworkCredential("my gmail address", "my password")
'mSmtpClient.Send(mMailMessage)
'MY DOMAIN
Dim mSmtpClient As New SmtpClient()
mSmtpClient.DeliveryMethod = SmtpDeliveryMethod.Network
mSmtpClient.UseDefaultCredentials = True
mSmtpClient.EnableSsl = False
mSmtpClient.Host = "smtp.mydomain.com"
mSmtpClient.Port = 587
mSmtpClient.Credentials = New System.Net.NetworkCredential("my full email address", "my password")
mSmtpClient.Send(mMailMessage)
Catch ex As Exception
'HttpContext.Current.Response.Redirect("~\EmailError.aspx")
MsgBox(ex.Message, MsgBoxStyle.Information)
End Try
End Sub