asp.net send mail with vb.net
Sending mail is with asp.net is simple, you can find it yourself with the next a few lines of code which are handled by button click event:
First importing the namespace:Imports
System.Net.MailThan the Handler code:
If Page.IsValid() ThenDim mySmtpClient As New SmtpClient Dim myMail As New MailMessageDim myFrom As New MailAddress("test@test.com")Dim myTo As New MailAddress("someone@test.com")myMail.BodyEncoding = System.Text.Encoding.UTF8
myMail.To.Add(myTo)
myMail.From = myFrom
myMail.Subject = "Web mail"
myMail.Body = vbCrLf & vbCrLf & "Hi, my name is John Anderson. I'am interested in ..."
mySmtpClient.Host = ConfigurationManager.AppSettings("test.com")
mySmtpClient.Credentials = New System.Net.NetworkCredential("webmaster@test.com", "password123", "test.com") TrymySmtpClient.Send(myMail)
lblAlert.Text = "Mail sending success message"
Catch ex As ExceptionlblAlert.Text = "Mail sening fail"
End Try End If