We often see that you can post comments on some blog pages and notify moderators via email (such as our blog garden). So how to send emails using asp.net? We can achieve this goal with the help of the powerful class library provided by .NET.
First we need to introduce the System.Web.Mail namespace.
Then create an instance of the MailMessage class. See the following code:
1'Create an instance
2Dim objMM as New MailMessage()
3
4'Set its properties
5objMM.To = " [email protected] "
6objMM.From = " [email protected] "
7objMM.Cc = " [email protected] "
8objMM.Bcc = " [email protected] "
9
10'Send as Text
11objMM.BodyFormat = MailFormat.Text
12' or send as Html
13objMM.BodyFormat = MailFormat.Html
14
15'Set the priority of emails
16objMM.Priority = MailPriority.Normal
17
18' Set theme
19objMM.Subject = "Hello there!"
20'Email text
21objMM.Body = "Hi!" & vbCrLf & vbCrLf & "How are you doing?"
22Finally
use the static method Send of the SmtpMail class to send
SmtpMail.Send(objMM)
It's that simple. See how powerful .NET is.
http://happyhzs2000.cnblogs.com/archive/2006/07/06/444596.html