Send an Email in ASP Dot Net using SmtpMail

Chikul
Posted by Chikul under ASP.NET category on | Views : 1930
Imports System.Drawing

Partial Class Default3
Inherits System.Web.UI.Page

Protected Sub btnSendMail_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSendMail.Click
'Send an Email in ASP Dot Net using SmtpMail
Try
Dim EmailTo As String = "Sample@sss.com"
Dim EmailFrom As String = "ddddd@sss.com"
Dim EmailSubject As String = "Sample Email"
Dim EmailBody As String = "Test email"
System.Web.Mail.SmtpMail.Send(EmailFrom, EmailTo, EmailSubject, EmailBody)
Response.Write("Mail sent Successfully.")
Catch ex As Exception
Response.Write("Mail Process Failure.")
End Try

End Sub
End Class

Comments or Responses

Login to post response