//引入System.Web.Mail名称空间
using System.Web.Mail;
//发送邮件的代码段
MailMessage mail = new MailMessage();
mail.From = "发件邮箱地址";
mail.To = "收件箱地址";
mail.Subject = "邮件主题";
mail.Body = "邮件内容";
mail.BodyFormat = MailFormat.Html;
mail.Priority = MailPriority.Normal;
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "邮箱用户名,如发件邮箱为BillGates@microsoft.com则此处填写BillGates");
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "邮箱密码");
System.Web.Mail.SmtpMail.SmtpServer = "发件邮箱的smtp服务器地址,如发件邮箱是163邮箱,则次处填写smtp.163.com";
System.Web.Mail.SmtpMail.Send(mail); //发送邮件