.net发送邮件
.net发送邮件
需引用 System.Net.Mail;
public void SendEmail(string from,string to,string subject, string body)
{
MailMessage message = new MailMessage(from,to);
message.Subject = subject;
message.IsBodyHtml = true;
message.Body = body;
SmtpClient client = new SmtpClient("smtp.163.com");
client.Credentials = new NetworkCredential("ganty", "xjhdjnd");
client.Send(message);
}