コード例 #1
0
        public string sendMail(UsedCarMailContent md)
        {
            ResultInfo r = new ResultInfo();

            #region 驗證碼
            ValidateResponse Validate = ValidateCaptcha(md.response);
            if (!Validate.Success)
            {
                r.result  = false;
                r.message = Resources.Res.Log_Err_googleValideNotEquel;
                return(defJSON(r));
            }
            #endregion
            try
            {
                using (db0 = getDB0())
                {
                    if (md.email == null)
                    {
                        r.result  = false;
                        r.message = Resources.Res.Log_Err_MailAddressBlank;
                        return(defJSON(r));
                    }
                    #region 信件發送
                    string  Body = getMailBody("UsedCarEmail", md);//套用信件版面
                    Boolean mail;
                    string  mailfrom = md.name + ":" + "*****@*****.**";

                    mail = Mail_Send(mailfrom,                       //寄信人
                                     openLogic().getReceiveMails(),  //收信人
                                     CommWebSetup.MailTitle_UsedCar, //信件標題
                                     Body,                           //信件內容
                                     true);                          //是否為html格式
                    if (mail == false)
                    {
                        r.result  = false;
                        r.message = Resources.Res.Log_Err_SendMailFail;
                        return(defJSON(r));
                    }
                    #endregion
                }
                r.result  = true;
                r.message = Resources.Res.Log_Success_SendMail;
            }
            catch (Exception ex)
            {
                r.result  = false;
                r.message = ex.Message;
            }
            return(defJSON(r));
        }
コード例 #2
0
        public string sendMail(UsedCarMailContent md)
        {
            ResultInfo r = new ResultInfo();
            #region 驗證碼
            ValidateResponse Validate = ValidateCaptcha(md.response);
            if (!Validate.Success)
            {
                r.result = false;
                r.message = Resources.Res.Log_Err_googleValideNotEquel;
                return defJSON(r);
            }
            #endregion
            try
            {
                using (db0 = getDB0())
                {
                    if (md.email == null)
                    {
                        r.result = false;
                        r.message = Resources.Res.Log_Err_MailAddressBlank;
                        return defJSON(r);
                    }
                    #region 信件發送
                    string Body = getMailBody("UsedCarEmail", md);//套用信件版面
                    Boolean mail;
                    string mailfrom = md.name + ":" + md.email;

                    mail = Mail_Send(mailfrom, //寄信人
                                    openLogic().getReceiveMails(), //收信人
                                    CommWebSetup.MailTitle_UsedCar, //信件標題
                                    Body, //信件內容
                                    true); //是否為html格式
                    if (mail == false)
                    {
                        r.result = false;
                        r.message = Resources.Res.Log_Err_SendMailFail;
                        return defJSON(r);
                    }
                    #endregion
                }
                r.result = true;
                r.message = Resources.Res.Log_Success_SendMail;
            }
            catch (Exception ex)
            {
                r.result = false;
                r.message = ex.Message;
            }
            return defJSON(r);
        }