MailMessage mail = new MailMessage(); mail.From = "\"***错误信息\" <***@163.com>";//设定发件人名字和地址(必须填写) 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","***"); //设定SMTP验证的用户名 mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "***"); //设定SMTP验证的密码 SmtpMail.SmtpServer = "smtp.163.com";//设定SMTP服务器地址 mail.To = "***@126.com" ;//设定收件人地址(必须填写)。 mail.Subject = "***错误信息"; mail.Body = "这里是发送的内容"; SmtpMail.Send(mail); 相关文章: 2021-11-12 2022-12-23 2021-09-26 2022-12-23 2021-12-24 2021-08-13