标签:
SmtpClient smtpServer = new SmtpClient("smtp.163.com"); smtpServer.Port = 25; smtpServer.Credentials = new System.Net.NetworkCredential("feiyang", "1234"); smtpServer.EnableSsl = true; MailMessage mail = new MailMessage(); mail.From = new MailAddress("feiyang@163.com");//和上面的对应 mail.To.Add("1234@qq.com"); mail.Subject = "会员注册信息";//标题 mail.SubjectEncoding = Encoding.UTF8; mail.Body = mailBoby; mail.Priority = System.Net.Mail.MailPriority.High;//邮件优先级 mail.IsBodyHtml = true; smtpServer.SendAsync(mail, "userToken");//异步发送第二个参数时一个用户定义对象,此对象将被传递给完成异步操作时所调用的方法,参数默认即可
// smtpServer.Send(mail);//同步发送
System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient(); smtp.Host = "smtp.163.com"; smtp.Credentials =new System.Net.NetworkCredential("feiyang","1234"); smtp.SendAsync("feiyanghenan@163.com", "1234@qq.com", "平台用户关联验证", "验证码:" + new Random().Next(1111, 9999).ToString(), "userToken");
网易邮箱设置获取(NetworkCredential)
http://jingyan.baidu.com/article/ff42efa93af8d9c19f22024e.html
标签:
原文地址:http://www.cnblogs.com/wangboke/p/5622389.html