System.Web.Mail.MailMessage mail = new System.Web.Mail.MailMessage(,2); try { mail.To = "收件人邮箱"; mail.From = "发件人邮箱"; mail.Subject = "subject"; mail.BodyFormat = System.Web.Mail.MailFormat.Html; mail.Body = "<font color='red'>body</font>"; mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1",2); //basic authentication mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "发件人邮箱",2); //set your username here mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "发件人邮箱密码",2); //set your password here mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", 465,2);//set port mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusessl", "true",2);//set is ssl System.Web.Mail.SmtpMail.SmtpServer = "smtp.qq.com"; System.Web.Mail.SmtpMail.Send(mail,2); //return true; } catch (Exception ex) { ex.ToString(,2); }