zoukankan      html  css  js  c++  java
  • net Email 发送(借助第三方)

     //发送邮件通知    

    public void SendEmail(Guid CompanyID)     {        

    //发件人邮箱        

    opa_company.ID = CompanyID;        

    opa_company = OPA_Company.GetEmailInfoByCID(opa_company);        

    string sendEmailAddress = opa_company.Email;        

    string sendEmailPassWord = opa_company.EmailPwd;        

    string SMTP = opa_company.SMTP;        

    //收件人邮箱        

    opa_company.ID = CompanyID;        

    opa_company=OPA_Company.GetEmailInfoByCID(opa_company);        

    string ResetEmailAddress = opa_company.Email;        

    Email email = new Email();        

    email.ID = opa_company.ID;        

    email.Name_Sender = "Admin";        

    email.Address_Sender = sendEmailAddress;        

    email.PassWord_Sender = sendEmailPassWord;        

    email.SMTP = SMTP;        

    email.Title = "续费通知";        

    email.Name_Receiver = opa_company.ContactMan;        

    email.Address_Receiver = opa_company.Email;        

    SmtpClient sc = new SmtpClient();        

    sc.EnableSsl = false;        

    sc.Host = email.SMTP;        

    sc.Port = 25;        

    sc.Credentials = new NetworkCredential(email.Address_Sender, email.PassWord_Sender);        

    MailMessage mm = new MailMessage();        

    mm.Priority = MailPriority.High;        

    mm.From = new MailAddress(email.Address_Sender, email.Name_Sender, Encoding.GetEncoding(936));        

    mm.To.Add(email.Address_Receiver);        

    mm.Subject = email.Title;        

    mm.SubjectEncoding = Encoding.GetEncoding(936);        

    mm.IsBodyHtml = true;        

    mm.BodyEncoding = Encoding.GetEncoding(936);        

    string Content = email.Name_Receiver + ",你好!<br/>贵公司的使用时间即将到期,请提前续费,以免延误工作。<br/>";        

    mm.Body = Content;        

    sc.Send(mm);

        }

  • 相关阅读:
    10.26 饮食
    10.25 饮食
    10.24饮食
    关于 wpf 的ICommand 的 CanExecute CanExecuteChanged func action的认识
    2018 10 23
    [Java]先有Class还是先有Object?
    [Java]如何制作一个WordCount-Plus的Plugin
    [java] 软工实践WordCount-Plus
    [java]基本数据类型
    [java]第一个程序
  • 原文地址:https://www.cnblogs.com/dreamzcy/p/3101242.html
Copyright © 2011-2022 走看看