public static void SendEMail(string senderEmail, string senderAuthCode, string smtpHost, int smtpPort,
string receiverEmail, string subject, string body)
{
MailMessage msg = new MailMessage();
msg.To.Add(receiverEmail);
//msg.To.Add(b@b.com);
//msg.CC.Add("c@c.com");可以抄送给多人
msg.From = new MailAddress(senderEmail);
msg.Subject = subject;
msg.SubjectEncoding = System.Text.Encoding.UTF8;
msg.Body = body;
msg.BodyEncoding = System.Text.Encoding.UTF8;
msg.IsBodyHtml = false;
msg.Priority = MailPriority.High;
SmtpClient client = new SmtpClient();
client.Credentials = new NetworkCredential(senderEmail, senderAuthCode);//senderAuthCode不是qq邮箱登录密码,需要在qq邮箱,设置>账户>smtp...,生成授权码
client.Port = smtpPort;//QqMail:587(注意:465是无效的)
client.Host = smtpHost;// "smtp.qq.com";
client.EnableSsl = true;//经过ssl加密
client.Send(msg);
}