'Create an instance of the MailMessage class
Dim objMM as New MailMessage();
'Set the properties
'Provide the recipient address
objMM.To = "recipient@someone.com"
'Provide your address
objMM.From = "myaddress@mydomain.com"
'If you want to CC this email to someone then provide it over here
objMM.Cc = "someone@someaddress.com"
'If you want to BCC this email to someone then provide it over here
objMM.Bcc = "someone2@someaddress2.com"
'Send the email in text format
'(to send HTML format, change MailFormat.Text to MailFormat.Html)
objMM.BodyFormat = MailFormat.Text
'Set the priority - options (High, Low, and Normal)
objMM.Priority = MailPriority.Normal
'Set the subject
objMM.Subject = "Hello there!"
'Set the body
objMM.Body = "Hi, How are you doing?"
'Now, to send the message, use the Send method of the SmtpMail class
SmtpMail.Send(objMM)
Make sure that you import the System.Web.Mail namespace in your ASP.NET Web page in order to be able to utilize the above code:
<% @Import Namespace="System.Web.Mail" %>.
Comment