位置:海鸟网 > IT > ASP.NET >

.net2.0邮件发送代码

System.Net.Mail.SmtpClient client = new SmtpClient(SmtpServer);
  client.UseDefaultCredentials = false;
  client.Credentials = new System.Net.NetworkCredential(UID, PWD);
  client.DeliveryMethod = SmtpDeliveryMethod.Network;
  
  System.Net.Mail.MailMessage message = new MailMessage(From,TO, Subject,Body);
  message.BodyEncoding = System.Text.Encoding.UTF8;
  message.IsBodyHtml = true;
  client.Send(message);