asp.net 发送邮件
System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage();
msg.To.Add("sheyou@sheyouyun.com");
msg.From = new MailAddress("renhanlinbsl@163.com", "renhanlinbsl@163.com", System.Text.Encoding.UTF8);
/* 上面3个参数分别是发件人地址(可以随便写),发件人姓名,编码*/
msg.Subject = "用户反馈"+DateTime.Now.ToString();//邮件标题
msg.SubjectEncoding = System.Text.Encoding.UTF8;//邮件标题编码
msg.Body = "邮件内容";//邮件内容
msg.BodyEncoding = System.Text.Encoding.UTF8;//邮件内容编码
msg.IsBodyHtml = false;//是否是HTML邮件
msg.Priority = MailPriority.High;//邮件优先级
SmtpClient client = new SmtpClient();
client.Credentials = new System.Net.NetworkCredential("renhanlinbsl@163.com", "xxxxxxxxxx");
client.Host = "smtp.163.com";
client.EnableSsl = true;//经过ssl加密
client.DeliveryMethod = SmtpDeliveryMethod.Network;
object userState = msg;
client.Send(msg);
联系我:renhanlinbsl@163.com
2016-8-11
14:25