• 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

  • 相关阅读:
    Windows Azure Redis 缓存服务
    Windows Azure支持七层负载均衡--Application Gateway
    使用中国版 Office 365 -- Team Site分享
    翻译 GITHUB上HOW TO BE A GOOD PROGRAMMER
    翻译 github上How to be a good programmer
    linux note
    vim note
    编程策略类note
    jni note
    python note
  • 原文地址:https://www.cnblogs.com/skyblue/p/674567.html
Copyright © 2020-2023  润新知