zoukankan      html  css  js  c++  java
  • C#电子邮件

    #region 电子邮件
        public static bool  webMail(string host, int port, string uid, string pwd, bool ssl, string from, string to, string subject, string body)
        {
            //string str="成功";
            System.Net.Mail.SmtpClient mail = new System.Net.Mail.SmtpClient();
            mail.Host = host;
            mail.Port = port;
            mail.Credentials = new System.Net.NetworkCredential(uid, pwd);
            mail.EnableSsl = ssl;
            System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage(from, to);
            message.Body = body;
            message.Subject = subject;
            message.SubjectEncoding = System.Text.Encoding.GetEncoding("gb2312");
            message.BodyEncoding = System.Text.Encoding.GetEncoding("gb2312");
            message.IsBodyHtml = true;
            try
            {
                mail.Send(message);
                message.Dispose();
                return true;
                //return str;
            }
            catch (Exception ex)
            {
                message.Dispose();

               return false;
               //return ex.ToString();
            }
        }
        #endregion

  • 相关阅读:
    文件权限---I
    python查看变量在内存中的地址
    Python3 基本数据类型
    print语法
    任务管理器启动项显示“没有可显示的启动项”如何解决?
    nginx 虚拟主机配置
    nginx 高级应用
    nginx 日志文件详解
    nginx 编译安装与配置使用
    python获取header脚本
  • 原文地址:https://www.cnblogs.com/skyblue/p/674567.html
Copyright © 2011-2022 走看看