清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
#region 邮件发送 /// <summary> /// 发送邮件支持HTML格式 先引用System.Net.Mail; /// </summary> /// <param name="MailFrom">发送人Email 如demo@126.com</param> /// <param name="MailServer">邮件服务器 如mail.126.com</param> /// <param name="MailUserName">登陆用户名 如demo@126.com</param> /// <param name="MailPassword">登陆密码 如123456</param> /// <param name="mailto">收件人邮箱</param> /// <param name="title">邮件标题</param> /// <param name="msg">邮件正文</param> /// <returns>成功 true; 失败 false</returns> public static bool SendSmtpEmail(string MailFrom, string MailServer, string MailUserName, string MailPassword, string mailto, string title, string msg) { var client = new SmtpClient(); client.Host = MailServer; client.UseDefaultCredentials = false; client.Credentials = new System.Net.NetworkCredential(MailUserName, MailPassword); client.DeliveryMethod = SmtpDeliveryMethod.Network; System.Net.Mail.MailMessage message = new MailMessage(MailFrom, mailto); message.Subject = title; message.Body = msg; message.SubjectEncoding = System.Text.Encoding.UTF8; message.BodyEncoding = System.Text.Encoding.UTF8; message.IsBodyHtml = true; message.Priority = MailPriority.High; message.IsBodyHtml = true; try { client.Send(message); return true; } catch { return false; } } #endregion