国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發(fā)設計 > 正文

一個通過web.Mail發(fā)送郵件的類

2019-11-18 19:09:55
字體:
供稿:網(wǎng)友

using System;
using System.Web;
using System.Web.Mail;
using Dottext.Framework;
using Dottext.Framework.Configuration;

namespace YourNamespace.Email
{
 /// <summary>
 /// Default implementation of the IMailPRovider
 /// </summary>
 public class SystemMail : IMailProvider
 {
  public SystemMail(){}

  #region
  private string _to;
  public string To
  {
   get{return _to;}
   set{_to = value;}
  }

  private string _from;
  public string From
  {
   get{return _from;}
   set{_from = value;}
  }

  private string _subject;
  public string Subject
  {
   get{return _subject;}
   set{_subject = value;}
  }

  private string _body;
  public string Body
  {
   get{return _body;}
   set{_body = value;}
  }
  #endregion

  private string _adminEmail;
  public string AdminEmail
  {
   get{return _adminEmail;}
   set{_adminEmail = value;}
  }

  private string _smtpServer = "localhost";
  public string SmtpServer
  {
   get{return _smtpServer;}
   set{_smtpServer = value;}
  }

  private string _passWord;
  public string Password
  {
   get{return _password;}
   set{_password = value;}
  }

  private string _userName;
  public string UserName
  {
   get{return _userName;}
   set{_userName = value;}
  }

  public bool Send(string to, string from, string subject, string message)
  {
   try
   {
    MailMessage em = new MailMessage();
    em.To = to;
    em.From = from;
    em.Subject = subject;
    em.Body = message;

    //Found out how to send authenticated email via System.Web.Mail at http://SystemWebMail.com (fact 3.8)
    if(this.UserName != null && this.Password != null)
    {
     em.Fields.Add("     em.Fields.Add("     em.Fields.Add("    
    }

    SmtpMail.SmtpServer = this.SmtpServer;
    SmtpMail.Send(em);
   
    return true;
   }
   catch
   {
    return false;
   }
  }

 
 }
}


發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 尉氏县| 武平县| 凉山| 凤庆县| 桦南县| 萨迦县| 潜山县| 内丘县| 巴中市| 东乡族自治县| 黄梅县| 施甸县| 新乡县| 泰州市| 清河县| 托克托县| 宁波市| 萨嘎县| 茌平县| 开鲁县| 双桥区| 维西| 金门县| 甘谷县| 东海县| 武穴市| 胶州市| 盐源县| 镇雄县| 沁阳市| 巴林右旗| 灵石县| 新竹市| 封开县| 高安市| 沽源县| 景德镇市| 宜阳县| 鹤山市| 米易县| 富平县|