コード例 #1
0
ファイル: SendMail.cs プロジェクト: ngochoanhbr/dahuco
        private string SendMailToMutiUser(string strTitle, string strCont, string strCondition)
        {
            string text  = string.Empty;
            string text2 = " SELECT AutoID,UserName,Email,Mobile FROM cms_User WHERE Email<>'' ";

            if (!strCondition.IsNullOrEmpty())
            {
                text2 = text2 + " AND " + strCondition;
            }
            DataTable dataTable = PageBase.dbo.GetDataTable(text2);

            if (dataTable != null && dataTable.Rows.Count > 0)
            {
                foreach (DataRow dataRow in dataTable.Rows)
                {
                    string empty = string.Empty;
                    MsgService.SendMail(dataRow["Email"].ToString(), strTitle, strCont, out empty);
                    if (empty != "success")
                    {
                        text = text + "发送" + dataRow["Email"].ToString() + "邮件失败;";
                    }
                }
            }
            return(text);
        }
コード例 #2
0
        private void SendEmailOnFH(OrdersInfo order, UserInfo user)
        {
            bool   @bool       = WebUtils.GetBool(base.GetConfigValue("IsSendMailOnGoodsSend"));
            string configValue = base.GetConfigValue("MailTmpOnGoodsSend");

            if (@bool && !string.IsNullOrEmpty(configValue) && !string.IsNullOrEmpty(user.Email) && ValidateUtils.IsEmail(user.Email) && user != null)
            {
                MsgService.SendMail(user.Email, "您的订单已经发货", configValue.Replace("${username}", user.UserName).Replace("${orderno}", order.OrderNo).Replace("${sitename}", PageBase.config.SiteName).Replace("${send_date}", System.DateTime.Now.ToString()));
            }
        }
コード例 #3
0
ファイル: FeedbackDetail.cs プロジェクト: ngochoanhbr/dahuco
 protected void btnok_Click(object sender, System.EventArgs e)
 {
     if (!base.IsAuthorizedOp("Reply"))
     {
         base.ShowMsg("Không có thẩm quyền");
     }
     else
     {
         string text = base.Server.HtmlEncode(this.txtReply.Text);
         if (string.IsNullOrEmpty(text))
         {
             base.ShowMsg("请输入回复内容");
         }
         else
         {
             FeedbackInfo dataById = SinGooCMS.BLL.Feedback.GetDataById(base.OpID);
             dataById.Replier      = base.LoginAccount.AccountName;
             dataById.ReplyContent = text;
             dataById.ReplyDate    = System.DateTime.Now;
             if (SinGooCMS.BLL.Feedback.Update(dataById))
             {
                 string @string     = WebUtils.GetString(this.txtMail.Text);
                 string strMailBody = string.Concat(new string[]
                 {
                     "来自管理员的回复:<br/><div style='border-bottom:1px solid #ccc'>",
                     text,
                     "</div><br/>",
                     PageBase.config.SiteName,
                     "(",
                     PageBase.config.SiteDomain,
                     ")"
                 });
                 string empty = string.Empty;
                 if (this.chkReply2Mail.Checked && ValidateUtils.IsEmail(@string))
                 {
                     MsgService.SendMail(@string, "来自管理员的回复", strMailBody, out empty);
                 }
                 if (!string.IsNullOrEmpty(empty) && "success" != empty)
                 {
                     base.ShowMsg(empty);
                     PageBase.log.AddEvent(base.LoginAccount.AccountName, "回复留言[" + this.feedback.Title + "] thành công,但发送邮件失败");
                 }
                 else
                 {
                     PageBase.log.AddEvent(base.LoginAccount.AccountName, "回复留言[" + dataById.Title + "] thành công");
                     MessageUtils.DialogCloseAndParentReload(this);
                 }
             }
             else
             {
                 base.ShowMsg("回复留言失败");
             }
         }
     }
 }
コード例 #4
0
ファイル: SendDingYueMail.cs プロジェクト: ngochoanhbr/dahuco
        private static int SendMail(string strTitle, string strBody)
        {
            string str = string.Empty;
            int    num = 0;

            System.Collections.Generic.IList <DingYueInfo> list = SinGooCMS.BLL.DingYue.GetList(0, " IsTuiDing=0 ", "AutoID asc");
            if (list != null && list.Count > 0)
            {
                string empty = string.Empty;
                System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
                for (int i = 0; i < list.Count; i++)
                {
                    if (ValidateUtils.IsEmail(list[i].Email))
                    {
                        stringBuilder.Append(list[i].Email + ",");
                    }
                    if ((i + 1) % 5 == 0 || i >= list.Count - 1)
                    {
                        string empty2        = string.Empty;
                        string strReciveMail = stringBuilder.ToString().Trim().TrimEnd(new char[]
                        {
                            ','
                        });
                        MsgService.SendMail(strReciveMail, strTitle, strBody, out empty2);
                        if (empty2 != "success")
                        {
                            str = str + empty2 + ";";
                        }
                        else
                        {
                            num += stringBuilder.ToString().Trim().TrimEnd(new char[]
                            {
                                ','
                            }).Split(new char[]
                            {
                                ','
                            }).Length;
                        }
                        stringBuilder.Clear();
                    }
                }
            }
            return(num);
        }
コード例 #5
0
ファイル: SendMail.cs プロジェクト: ngochoanhbr/dahuco
        private string SendMailToCustom(string strRevicer, string strTitle, string strCont)
        {
            string text = string.Empty;

            string[] array = strRevicer.Split(new char[]
            {
                ','
            });
            for (int i = 0; i < array.Length; i++)
            {
                string empty = string.Empty;
                MsgService.SendMail(array[i], strTitle, strCont, out empty);
                if (empty != "success")
                {
                    text = text + "发送" + array[i] + "邮件失败;";
                }
            }
            return(text);
        }
コード例 #6
0
ファイル: MailConfig.cs プロジェクト: ngochoanhbr/dahuco
        protected void btnSend_Click(object sender, System.EventArgs e)
        {
            string @string = WebUtils.GetString(this.txtReciver.Text);

            if (ValidateUtils.IsEmail(@string))
            {
                string empty = string.Empty;
                if (MsgService.SendMail(@string, PageBase.config.SiteName + "Các tin nhắn thử nghiệm", "Đây là một tin nhắn kiểm tra, nếu bạn nhận được thông báo này,Dịch vụ chuyển phát nhanh hiệu quả!", out empty))
                {
                    base.ShowMsg("Thư được gửi thử nghiệm thành công");
                }
                else
                {
                    base.ShowMsg(empty);
                }
            }
            else
            {
                base.ShowMsg("E-mail người nhận không phải là một địa chỉ e-mail hợp lệ");
            }
        }
コード例 #7
0
ファイル: AjaxMethod.cs プロジェクト: ngochoanhbr/dahuco
        private void SaveFeedback()
        {
            string formString  = WebUtils.GetFormString("_uname");
            string formString2 = WebUtils.GetFormString("_email");
            string formString3 = WebUtils.GetFormString("_mobile");
            string formString4 = WebUtils.GetFormString("_phone");
            string formString5 = WebUtils.GetFormString("_title");
            string formString6 = WebUtils.GetFormString("_content");

            if (string.Compare(base.ValidateCode, WebUtils.GetFormString("_yzm"), true) != 0)
            {
                base.Response.Write("{\"msg\":\"" + base.GetCaption("ValidateCodeIncorrect") + "\",\"status\":\"fail\"}");
            }
            else if (string.IsNullOrEmpty(formString))
            {
                base.Response.Write("{\"msg\":\"" + base.GetCaption("Feedback_UserNameEmpty") + "\",\"status\":\"fail\"}");
            }
            else if (string.IsNullOrEmpty(formString6))
            {
                base.Response.Write("{\"msg\":\"" + base.GetCaption("Feedback_ContentEmpty") + "\",\"status\":\"fail\"}");
            }
            else
            {
                FeedbackInfo feedbackInfo = new FeedbackInfo
                {
                    UserName      = formString,
                    Title         = (string.IsNullOrEmpty(formString5) ? base.GetCaption("Feedback_Title").Replace("${username}", formString) : formString5),
                    Content       = formString6,
                    Email         = formString2,
                    Mobile        = formString3,
                    Telephone     = formString4,
                    IPaddress     = IPUtils.GetIP(),
                    Replier       = string.Empty,
                    ReplyContent  = string.Empty,
                    ReplyDate     = new System.DateTime(1900, 1, 1),
                    IsAudit       = true,
                    Lang          = base.cultureLang,
                    AutoTimeStamp = System.DateTime.Now
                };
                int num = Feedback.Add(feedbackInfo);
                if (num > 0)
                {
                    string empty = string.Empty;
                    if (WebUtils.GetBool(base.GetConfigValue("IsSendMailForLY")) && !string.IsNullOrEmpty(base.GetConfigValue("ReciverEMail")))
                    {
                        if (MsgService.SendMail(base.GetConfigValue("ReciverEMail"), formString5, feedbackInfo.Content, out empty))
                        {
                            base.Response.Write("{\"msg\":\"" + base.GetCaption("Feedback_Success") + "\",\"status\":\"success\"}");
                        }
                        else
                        {
                            base.Response.Write("{\"msg\":\"" + base.GetCaption("Feedback_SuccessButMailFail") + "\",\"status\":\"fail\"}");
                        }
                    }
                    else
                    {
                        base.Response.Write("{\"msg\":\"" + base.GetCaption("Feedback_Success") + "\",\"status\":\"success\"}");
                    }
                }
                else
                {
                    base.Response.Write("{\"msg\":\"" + base.GetCaption("Feedback_Error") + "\",\"status\":\"fail\"}");
                }
            }
        }
コード例 #8
0
ファイル: AjaxMethod.cs プロジェクト: ngochoanhbr/dahuco
        private void GetMailCode(string strMailType)
        {
            string randomNumber = StringUtils.GetRandomNumber(5, true);
            string text         = string.Empty;
            string strSubject   = string.Empty;

            if (strMailType == "reg")
            {
                strSubject = "注册验证码";
                text       = base.GetConfigValue("RegMailCheckCode").Replace("${checkcode}", randomNumber);
            }
            else if (strMailType == "findpwd")
            {
                strSubject = "找回密码验证码";
                text       = base.GetConfigValue("GetPwdMailCheckCode").Replace("${username}", WebUtils.GetQueryString("username")).Replace("${checkcode}", randomNumber);
            }
            else if (strMailType == "bind")
            {
                strSubject = "会员绑定验证码";
                text       = base.GetConfigValue("BindMailCheckCode").Replace("${username}", WebUtils.GetQueryString("username")).Replace("${checkcode}", randomNumber);
            }
            string queryString = WebUtils.GetQueryString("paramval");
            string s           = "{\"ret\":\"fail\",\"timeout\":0,\"msg\":\"邮箱验证码发送失败\"}";
            bool   flag        = true;

            if (!string.IsNullOrEmpty(queryString))
            {
                if ((strMailType == "reg" || strMailType == "bind") && SinGooCMS.BLL.User.IsExistsByEmail(queryString))
                {
                    s = "{\"ret\":\"exists\",\"timeout\":0,\"msg\":\"邮箱地址已存在\"}";
                }
                else
                {
                    SMSInfo lastCheckCode = SMS.GetLastCheckCode(queryString);
                    if (lastCheckCode != null)
                    {
                        System.TimeSpan timeSpan = System.DateTime.Now - lastCheckCode.AutoTimeStamp;
                        if (timeSpan.TotalSeconds < 60.0)
                        {
                            flag = false;
                            s    = "{\"ret\":\"fail\",\"timeout\":" + (60.0 - timeSpan.TotalSeconds).ToString("f0") + ",\"msg\":\"发送间隔太短\"}";
                        }
                    }
                    if (flag)
                    {
                        string empty = string.Empty;
                        if (MsgService.SendMail(queryString, strSubject, text, out empty))
                        {
                            SMSInfo entity = new SMSInfo
                            {
                                SMSMob        = queryString,
                                SMSText       = text,
                                SMSType       = "CheckCode",
                                ValidateCode  = randomNumber,
                                ReturnMsg     = empty,
                                Status        = 1,
                                AutoTimeStamp = System.DateTime.Now
                            };
                            SMS.Add(entity);
                            s = "{\"ret\":\"success\",\"timeout\":60,\"msg\":\"邮箱验证码发送成功,请登录邮箱查收!\"}";
                        }
                        else
                        {
                            s = "{\"ret\":\"fail\",\"timeout\":0,\"msg\":\"" + empty + "\"}";
                        }
                    }
                }
            }
            base.Response.Write(s);
        }