全速加载中

程序发送邮件代码

MailMessage mailMessage = new MailMessage();
mailMessage.From = new MailAddress("bbb@xuhongfei.com", "bbb");
mailMessage.To.Add(new MailAddress("aaa@xuhongfei.com","aaa"));
mailMessage.Subject = "邮件啊";
byte[] bytes;

bytes = Encoding.UTF8.GetBytes("真个无人能比");
mailMessage.Body = Encoding.UTF8.GetString(bytes);

SmtpClient smtpClient = new SmtpClient("127.0.0.1");
smtpClient.Credentials = new System.Net.NetworkCredential("bbb","bbb");
smtpClient.Send(mailMessage);

posted @ 2013-03-02 10:46  许鸿飞  阅读(196)  评论(0编辑  收藏  举报