System.Net.Mail
using System.Net.Mail;
using System.Net;
1publicstaticvoid Send(string MessageFrom, string MessageTo, string MessageSubject, string MessageBody)
2 {
3try 4 {
5 MailMessage message =new MailMessage();
6 message.From =new MailAddress(MessageFrom); 7 message.To.Add(new MailAddress(MessageTo)); //收件人地址,任意 8 message.Subject = MessageSubject; //标题 9 message.SubjectEncoding = Encoding.UTF8; //转码,当然,这个依据情况来10 message.Body = MessageBody; //正文11 SmtpClient client =new SmtpClient("smtp.qq.com"); //创建Smtp实例12 client.Credentials =new NetworkCredential(); // 添加验证信息13 client.Send(message); //发送邮件14 }
15catch (Exception ex)
16 {
17throw ex;
18 }
19 }
-------------------------------------------------
!!!作者:木由水 http://www.cnblogs.com/muyoushui