C# 发送邮件代码

  C# 发送邮件代码 

1   MailMessage mailMsg = new MailMessage(); //using System.Net; 引用
2             mailMsg.From = new MailAddress("lcfhn168@163.com", "lichunfang");//发件邮箱
3             mailMsg.To.Add(new MailAddress("459928575@qq.com", "lichunfang"));//收件邮箱
4             mailMsg.Subject = "Hello ..."; //主题
5             mailMsg.Body = "ni hao  ,,,,,";//.内容
6             SmtpClient client = new SmtpClient("smtp.163.com"); //smtp.126.com  smtp.qq.com 
7             client.Credentials = new NetworkCredential("lcfhn168", "");//用户名,密码
8             client.Send(mailMsg);

 

posted @ 2015-09-05 22:46  每天进步一点点!  阅读(946)  评论(0编辑  收藏  举报