/// <summary>
/// C#发送邮件(163邮箱)
/// </summary>
/// <param name="MailFrom">邮箱用户名</param>
/// <param name="MailTo">接收人用户名</param>
/// <param name="MailPwd">邮箱密码</param>
/// <param name="Mailtitle">邮件主题</param>
/// <param name="MailCon">邮件内容</param>
public void MailSend(string MailFrom,string MailTo,string MailPwd,string Mailtitle,string MailCon)
{
MailMessage MyMail = new MailMessage();
MyMail.From = new MailAddress(MailFrom + "@163.com", "");
MyMail.To.Add(new MailAddress(MailTo + "@163.com"));
MyMail.Subject = Mailtitle;
MyMail.Body = MailCon;
MyMail.IsBodyHtml = false;
SmtpClient smtpclient = new SmtpClient();
smtpclient.DeliveryMethod = SmtpDeliveryMethod.Network;
smtpclient.Host = "smtp.163.com";
smtpclient.Credentials = new System.Net.NetworkCredential(MailFrom, MailPwd);
smtpclient.Send(MyMail);
}
/// C#发送邮件(163邮箱)
/// </summary>
/// <param name="MailFrom">邮箱用户名</param>
/// <param name="MailTo">接收人用户名</param>
/// <param name="MailPwd">邮箱密码</param>
/// <param name="Mailtitle">邮件主题</param>
/// <param name="MailCon">邮件内容</param>
public void MailSend(string MailFrom,string MailTo,string MailPwd,string Mailtitle,string MailCon)
{
MailMessage MyMail = new MailMessage();
MyMail.From = new MailAddress(MailFrom + "@163.com", "");
MyMail.To.Add(new MailAddress(MailTo + "@163.com"));
MyMail.Subject = Mailtitle;
MyMail.Body = MailCon;
MyMail.IsBodyHtml = false;
SmtpClient smtpclient = new SmtpClient();
smtpclient.DeliveryMethod = SmtpDeliveryMethod.Network;
smtpclient.Host = "smtp.163.com";
smtpclient.Credentials = new System.Net.NetworkCredential(MailFrom, MailPwd);
smtpclient.Send(MyMail);
}
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步