.net自带的发送email方法
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);
浙公网安备 33010602011771号