Sending Emails with ASP .NET
First step is to import the System.Web.Mail where the classes SmtpMail and MailMessage classes reside:
Imports System.Web.Mail
Next, declare a variable of type MailMessage :
Dim MMsg As MailMessage
Then create an instance of MailMessage and set the properties.
MMsg = New MailMessage MMsg.From = "bmgt406/407 <your address>" MMsg.To = txtTo.Text MMsg.Cc = txtCC.Text MMsg.Subject = txtSubject.Text MMsg.Body = txtContent.Text MMsg.BodyFormat = MailFormat.Text
The last step is to specify the mail server, the mail server at rhsmith.umd.edu does not relay email requests so the application will have to reside on the class server.
SmtpMail.SmtpServer = "smtp.rhsmith.umd.edu" SmtpMail.Send(MMsg)
The application can be viewed here:
sendmail.aspx