
June 21st, 2005, 04:59 PM
|
|
Registered User
|
|
Join Date: Nov 2004
Posts: 22
Time spent in forums: 8 h 16 m
Reputation Power: 0
|
|
|
The first line in the subroutine creates a MailMessage object. This object is available because we have included a reference to the "System.Web.Mail" namespace. This object basically mirrors the options of a standard email message, so the naming is very intuitive. Set the properties of the new MailMessage object based on the values from the form variables. Once the properties are set, we only need to call SmtpMail.Send to execute the delivery of the mail message.
import System.Web.Mail
Sub SendMail (Obj As Object, E As EventArgs)
Dim mailObj AS new MailMessage
mailObj.From = MsgFrom.text
mailObj.To = MsgTo.Text
mailObj.Subject = MsgSubject.Text
mailObj.Body = MsgBody.Text
SmtpMail.SmtpServer = "localhost"
SmtpMail.Send(mailObj)
End Sub
|