Dim objMailMessage As New System.Net.Mail.MailMessage
Try
With objMailMessage
.IsBodyHtml = True
.From = New Net.Mail.MailAddress(strEmailFrom)
.To.Add(strEmailTo)
.Bcc.Add("******@yahoo.com")
.Subject = strSubject
.Body = strBodyEmail
End With
Dim objSMTPClient As New System.Net.Mail.SmtpClient("relay-hosting.secureserver.net", 25)
objSMTPClient.Credentials = CredentialCache.DefaultNetworkCredentials
objSMTPClient.DeliveryMethod = SmtpDeliveryMethod.Network
objSMTPClient.Send(objMailMessage)
lblMessage.Text = "Farriintaada waa la diray. "
Catch ex As Exception
lblMessage.Text = "Email not sent. " & ex.ToString
End Try
|