/ Published in: VB.NET
Make sure to change the partial class name. It's based on the page name. Also, don't forget to create a ThankYou.aspx page!
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
Imports System.Net.Mail Imports System.Net.Configuration Partial Class _Default Inherits System.Web.UI.Page Protected Sub btnSumbit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSumbit.Click Dim client As New SmtpClient("RS-E133-V.bckcom.com") mmsg.IsBodyHtml = True mmsg.Body &= "<html>" mmsg.Body &= "<body>" mmsg.Body &= "<style type&='text/css'>body{font:arial, verdana; font-size:11pt;}b{font-size:10pt; color:blue;}</style>" mmsg.Body &= "<b>Time Submited: </b> " + DateTime.Now mmsg.Body &= "<br />" mmsg.Body &= "Sentby: " + tbName.Text mmsg.Body &= "<br />" mmsg.Body &= "<hr />" mmsg.Body &= "<b>First Name: </b> " + tbName.Text mmsg.Body &= "<br />" mmsg.Body &= "<b>Email: </b> " + tbEmail.Text mmsg.Body &= "<br />" mmsg.Body &= "<b>Message: </b> " + tbMessage.Value mmsg.Body &= "<br />" mmsg.Subject &= "Subject" 'Type in Subject Here 'Now, to send the message, use the Send method of the SmtpMail class If IsValid Then client.Send(mmsg) Response.Redirect("~/Thankyou.aspx") 'Where the form should redirect to, don't forget to create this page End If End Sub End Class