/// <summary>
    /// 發信給設定的信箱 By 訊息
    /// </summary>
    /// <param name="messageVO"></param>
    public void SendMail_ToContactor_ByMessage(MessageVO messageVO)
    {
        try
        {
            string classify = "聯絡我們收件者";
            IList <ItemParamVO> contactorList = m_SystemService.GetAllItemParamByNoDel(classify);

            if (contactorList != null && contactorList.Count > 0)
            {
                SystemParamVO mailVO      = m_SystemService.GetSystemParamByRoot();
                MailService   mailService = new MailService(mailVO.MailSmtp, int.Parse(mailVO.MailPort), mailVO.EnableSSL, mailVO.Account, mailVO.Password);

                StringBuilder sbMailList = new StringBuilder();
                foreach (ItemParamVO contactor in contactorList)
                {
                    sbMailList.Append(string.Format("{0};", contactor.Value));
                }

                string mailTitle   = string.Format("收到一封由【{0}】從網站發出的線上諮詢。", messageVO.CreateName);
                string mailContent = GenMailContent(messageVO);

                mailService.SendMail(mailVO.SendEmail, sbMailList.ToString(), mailTitle, mailContent);
            }
        }
        catch (Exception ex)
        {
            m_Log.Error(ex);
        }
    }
Пример #2
0
        private void InitSystemParam()
        {
            //系統設定
            SystemParamVO systemParamVO = new SystemParamVO();

            //systemParamVO.MailSmtp = "smtp.gmail.com";
            //systemParamVO.Account = "*****@*****.**";
            //systemParamVO.SendEmail = "*****@*****.**";
            //systemParamVO.MailPort = "587";
            //systemParamVO.EnableSSL = true;
            //systemParamVO.Password = "******";

            //systemParamVO.MailSmtp = "60.248.85.123";
            //systemParamVO.Account = "SmtpUser";
            //systemParamVO.SendEmail = "*****@*****.**";
            //systemParamVO.MailPort = "25";
            //systemParamVO.EnableSSL = false;
            //systemParamVO.Password = "******";

            //systemParamVO.PageTitle = "彼得杜拉克社會企業";
            //systemParamVO.PageKeyWord = "彼得杜拉克社會企業";
            //systemParamVO.PageDescription = "彼得杜拉克社會企業";

            systemParamVO.FilePassword = "";
            m_SystemService.CreateSystemParam(systemParamVO);
        }
    /// <summary>
    /// 發確認信給會員
    /// </summary>
    /// <param name="messageVO"></param>
    public void SendConfirmMail_ToMember(MemberVO memberVO)
    {
        try
        {
            SystemParamVO mailVO      = m_SystemService.GetSystemParamByRoot();
            MailService   mailService = new MailService(mailVO.MailSmtp, int.Parse(mailVO.MailPort), mailVO.EnableSSL, mailVO.Account, mailVO.Password);

            string mailTitle   = "收到一封從網站的會員認證信。";
            string mailContent = GenMailContent(memberVO);

            mailService.SendMail(mailVO.SendEmail, memberVO.Email, mailTitle, mailContent);
        }
        catch (Exception ex)
        {
            m_Log.Error(ex);
        }
    }
Пример #4
0
        public WebMailService()
        {
            m_FTISFactory = new FTISFactory();
            m_MailVO      = m_FTISFactory.GetSystemParam();

            bool enableSSL = m_MailVO.EnableSSL;
            int  port      = 25;

            if (m_MailVO.MailSmtp.IndexOf("gmail") != -1)
            {
                enableSSL = true;
                port      = 587;
            }
            else if (!string.IsNullOrEmpty(m_MailVO.MailPort))
            {
                port = int.Parse(m_MailVO.MailPort);
            }

            m_MailService = new MailService(m_MailVO.MailSmtp, port, enableSSL, m_MailVO.Account, m_MailVO.Password);
        }
Пример #5
0
        public WuDADAMailService()
        {
            IApplicationContext ctx = ContextRegistry.GetContext();
            myService = (MyService)ctx.GetObject("MyService");
            authService = (IAuthService)ctx.GetObject("AuthService");

            systemParamVO = myService.Dao.DaoGetVOById<SystemParamVO>(VarHelper.WuDADA_SYSTEMPARAM_ID);

            bool enableSSL = systemParamVO.IsEnableSSL;
            int port = 25;

            if (systemParamVO.MailSmtp.IndexOf("gmail") != -1)
            {
                enableSSL = true;
                port = 587;
            }
            else if (!string.IsNullOrEmpty(systemParamVO.MailPort))
            {
                port = int.Parse(systemParamVO.MailPort);
            }
            mailService = new MailService(systemParamVO.MailSmtp, port, enableSSL, systemParamVO.Account, systemParamVO.Password);
        }
Пример #6
0
        public void Test_SendMessageMail()
        {
            //建立一篇訊息
            MessageVO messageVO = new MessageVO();

            messageVO.Content     = "意見";
            messageVO.CreateName  = "張大保";
            messageVO.EMail       = "*****@*****.**";
            messageVO.Fax         = "23223333";
            messageVO.Phone       = "22234563";
            messageVO.Mobile      = "0912333444";
            messageVO.CreatedDate = DateTime.Now;
            messageVO.CreateIP    = "127.0.0.1";

            messageVO = m_MessageService.CreateMessage(messageVO);

            string classify = "聯絡我們收件者";
            IList <ItemParamVO> contactorList = m_SystemService.GetAllItemParamByNoDel(classify);

            if (contactorList != null && contactorList.Count > 0)
            {
                SystemParamVO mailVO      = m_SystemService.GetSystemParamByRoot();
                MailService   mailService = new MailService(mailVO.MailSmtp, int.Parse(mailVO.MailPort), mailVO.EnableSSL, mailVO.Account, mailVO.Password);

                StringBuilder sbMailList = new StringBuilder();
                foreach (ItemParamVO contactor in contactorList)
                {
                    sbMailList.Append(string.Format("{0};", contactor.Value));
                }

                string mailTitle   = string.Format("收到一封由【{0}】從產基會網站提出的意見信。", messageVO.CreateName);
                string mailContent = GenMailContent(messageVO);

                mailService.SendMail(mailVO.SendEmail, sbMailList.ToString(), mailTitle, mailContent);
            }
        }
Пример #7
0
 /// <summary>
 /// 刪除系統參數
 /// </summary>
 /// <param name="systemParamVO">被刪除的系統參數</param>
 public void DeleteSystemParam(SystemParamVO systemParamVO)
 {
     NHibernateDao.Delete(systemParamVO);
 }
Пример #8
0
        /// <summary>
        /// 更新系統參數
        /// </summary>
        /// <param name="systemParamVO">被更新的系統參數</param>
        /// <returns>更新後的系統參數</returns>
        public SystemParamVO UpdateSystemParam(SystemParamVO systemParamVO)
        {
            NHibernateDao.Update(systemParamVO);

            return(systemParamVO);
        }
Пример #9
0
        /// <summary>
        /// 新增系統參數
        /// </summary>
        /// <param name="systemParamVO">被新增的系統參數</param>
        /// <returns>新增後的系統參數</returns>
        public SystemParamVO CreateSystemParam(SystemParamVO systemParamVO)
        {
            NHibernateDao.Insert(systemParamVO);

            return(systemParamVO);
        }
Пример #10
0
    private void intiSystemParam()
    {
        //系統設定
        SystemParamVO spVO1 = new SystemParamVO();
        spVO1.MailSmtp = "smtp.gmail.com";
        spVO1.Account = "*****@*****.**";
        spVO1.SendEmail = "*****@*****.**";
        spVO1.MailPort = "587";
        spVO1.IsEnableSSL = true;
        spVO1.Password = "******";
        spVO1.ComName = "WuDADA";
        spVO1.ComEngName = "WuDADA";
        spVO1.ComCEO = "WuDADA";

        myService.DaoInsert(spVO1);
    }
Пример #11
0
 /// <summary>
 /// 刪除系統參數
 /// </summary>
 /// <param name="systemParamVO">被刪除的系統參數</param>
 public void DeleteSystemParam(SystemParamVO systemParamVO)
 {
     SystemDao.DeleteSystemParam(systemParamVO);
 }
Пример #12
0
 /// <summary>
 /// 更新系統參數
 /// </summary>
 /// <param name="systemParamVO">被更新的系統參數</param>
 /// <returns>更新後的系統參數</returns>
 public SystemParamVO UpdateSystemParam(SystemParamVO systemParamVO)
 {
     return(SystemDao.UpdateSystemParam(systemParamVO));
 }
Пример #13
0
 /// <summary>
 /// 新增系統參數
 /// </summary>
 /// <param name="systemParamVO">被新增的系統參數</param>
 /// <returns>新增後的系統參數</returns>
 public SystemParamVO CreateSystemParam(SystemParamVO systemParamVO)
 {
     return(SystemDao.CreateSystemParam(systemParamVO));
 }