Public void Sendmail ()
{
// Instantiate the mailmessage object
System. Web. Mail. mailmessage mail = new system. Web. Mail. mailmessage ();
// Define the mail sending Address
Mail. From = "aierong@126.com ";
// Define the email Receiving address
// Set a list of recipient email addresses separated by semicolons
Mail. To = "aierong@126.com ";
// Define the mail's dark sending Address
// Set the list of email addresses separated by semicolons
Mail. bcc = "a@126.com ";
// Define the CC address of the email
// Set the list of email addresses separated by semicolons
Mail. Cc = "abc@371.net; aaa@263.net ";
// Define the subject of the email
Mail. Subject = ". Net email ";
// Set the email body content type
// Here we send the message in HTML Format
Mail. bodyformat = system. Web. Mail. mailformat. html;
// Set the email body
Mail. Body = "Go ";
// Set an attachment
System. Web. Mail. mailattachment = new system. Web. Mail. mailattachment (@ "D:/abc.doc ");
// Add an attachment to the email
Mail. attachments. Add (mailattachment );
// SMTP Server
// Authentication is required for many SMTP servers
System. Web. Mail. smtpmail. smtpserver = "smtp.126.com ";
// Verify
Mail. Fields. Add ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1 ");
// Login Name
Mail. Fields. Add ("http://schemas.microsoft.com/cdo/configuration/sendusername", "aierong ");
// Login Password
Mail. Fields. Add ("http://schemas.microsoft.com/cdo/configuration/sendpassword ","*******");
// Send
System. Web. Mail. smtpmail. Send (Mail );
}