zoukankan      html  css  js  c++  java
  • asp.net发送邮件功能

      /// <summary>
            /// 发送邮箱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));
                MyMail.Subject = Mailtitle;
                MyMail.SubjectEncoding = System.Text.Encoding.UTF8;
                MyMail.Body = MailCon;
                MyMail.BodyEncoding = System.Text.Encoding.UTF8;
                MyMail.IsBodyHtml = false;
                SmtpClient smtp = new SmtpClient();
                smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
                smtp.Host = "smtp.163.com";
                smtp.Credentials = new System.Net.NetworkCredential(MailFrom, MailPwd);
                smtp.Send(MyMail);
            }

    以上代码是可以运行的本人以测试过

  • 相关阅读:
    整理:分页存储过程整理
    净利润-流通市值比率”与公司估值
    常见7种股票底部形态(图解)
    nginx
    移动成本分布1
    浅谈公开信息检索和判断能力
    股票技术分析 成交量与换手率专题
    成份股和成份股指数
    股票底部形态初探
    筹码拉抬派发法
  • 原文地址:https://www.cnblogs.com/yshj/p/1872165.html
Copyright © 2011-2022 走看看