MailMessage mail = new MailMessage(); mail.From = "发送者的Email"; mail.To = "接收者的Email"; mail.Subject = "主题"; mail.Body = "内容"; mail.BodyFormat = MailFormat.Html;//用html格式 mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //basic authentication mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "邮箱用户名"); //set your username here mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "邮箱密码"); //set your password here SmtpMail.SmtpServer = "smtp.126.com";//这里写邮局地址 SmtpMail.Send(mail); 转载于:https://www.cnblogs.com/wolanda/archive/2005/03/12/117615.html