protected void Save_Btn_Click(object sender, EventArgs e)
 {
     M_UserInfo mu = buser.GetLogin();
     Acount_T.Text = Acount_T.Text.Replace(" ", "");
     M_Plat_MailConfig configMod = null;
     if (Mid > 0) { configMod = configBll.SelReturnModel(Mid); }
     else
     {
         //检测邮箱是否已存在
         configMod = configBll.SelByMail(mu.UserID, Acount_T.Text);
         if (configMod != null) { function.WriteErrMsg("[" + Acount_T.Text + "]邮箱已经存在,不能重复添加"); }
         configMod = new M_Plat_MailConfig();
     }
     configMod.POP = POP_T.Text;
     configMod.SMTP = SMTP_T.Text;
     configMod.Alias = Alias_T.Text;
     configMod.Acount = Acount_T.Text;
     configMod.Passwd = Passwd_T.Text;
     configMod.Days = DataConverter.CLng(Days_T.Text);
     configMod.Days = configMod.Days == 0 ? 30 : configMod.Days;
     if (Mid > 0)
     {
         configBll.UpdateByID(configMod);
     }
     else
     {
         configMod.UserID = mu.UserID;
         configMod.CDate = DateTime.Now;
         configBll.Insert(configMod);
     }
     function.Script(this, "parent.location=parent.location;");
 }
Esempio n. 2
0
        protected void Send_Btn_Click(object sender, EventArgs e)
        {
            M_UserInfo        mu        = buser.GetLogin();
            M_Plat_MailConfig configMod = configBll.SelByMail(mu.UserID, Emails_D.SelectedItem.Text);
            MailAddress       Address   = new MailAddress(Receiver_T.Text);
            MailInfo          model     = new MailInfo();

            model.Subject    = TxtTitle.Text;
            model.ToAddress  = Address;
            model.MailBody   = EditorContent.Text;
            model.IsBodyHtml = true;
            string ppaths = "";

            foreach (string vpath in Attach_Hid.Value.Split('|'))
            {
                if (string.IsNullOrEmpty(vpath))
                {
                    continue;
                }
                ppaths += function.VToP(vpath) + "|";
            }
            ppaths = ppaths.TrimEnd('|');
            SendMail.SendEmail(configMod.Acount, configMod.Passwd, configMod.SMTP, model, ppaths.Split('|'));
            SaveMail(Attach_Hid.Value);
            function.WriteSuccessMsg("发送成功!", "Default.aspx");
        }
Esempio n. 3
0
        protected void EGV_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int id = Convert.ToInt32(e.CommandArgument);

            switch (e.CommandName.ToLower())
            {
            case "receive":
                M_Plat_MailConfig configMod = new M_Plat_MailConfig();
                break;

            case "del2":
                configBll.Del(id);
                break;
            }
            MyBind();
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Mid > 0)
         {
             M_Plat_MailConfig model = configBll.SelModelByUid(Mid, buser.GetLogin().UserID);
             if (model == null) { function.WriteErrMsg("信息不存在,或你无权修改该信息"); }
             Alias_T.Text = model.Alias;
             POP_T.Text = model.POP;
             SMTP_T.Text = model.SMTP;
             Acount_T.Text = model.Acount;
             Passwd_T.Attributes.Add("value", model.Passwd);
             Days_T.Text = model.Days.ToString();
         }
     }
 }