日期:2014-05-17 浏览次数:20409 次
string from = "webmaster@xxx.cn"; string pwd = "xxxxxxxxx"; string to = user.Email; string subject = "欢迎加入xxx,请激活您的帐号"; string body = GetEMailBody(user); SmtpClient client = new SmtpClient(); client.Host = "smtp.xxx.cn"; client.UseDefaultCredentials = false; client.Port = 25; client.Credentials = new System.Net.NetworkCredential(from, pwd); client.DeliveryMethod = SmtpDeliveryMethod.Network; MailMessage message = new MailMessage(from, to); message.Subject = subject; message.Body = body; message.BodyEncoding = Encoding.UTF8; message.IsBodyHtml = true; client.Send(message);