Beispiel #1
0
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        ZWL.BLL.ERPNetEmail MyModel = new ZWL.BLL.ERPNetEmail();
        MyModel.EmailTitle   = this.TextBox1.Text;
        MyModel.EmailContent = this.TxtContent.Text;
        string filelist = ZWL.Common.PublicMethod.GetSessionValue("WenJianList");

        if (filelist != null && filelist != "")
        {
            MyModel.FuJian = ZWL.Common.PublicMethod.GetSessionValue("WenJianList");
        }
        else
        {
            MyModel.FuJian = null;
        }

        MyModel.FromUser   = ZWL.Common.PublicMethod.GetSessionValue("UserName");
        MyModel.EmailState = "已发";
        MyModel.TimeStr    = DateTime.Now;
        MyModel.ToUser     = this.TextBox2.Text.Trim();

        try
        {
            //获取现有设置
            ZWL.BLL.ERPPOPAndSMTP MySMTPModel = new ZWL.BLL.ERPPOPAndSMTP();
            MySMTPModel.GetModel(int.Parse(ZWL.Common.PublicMethod.GetSessionValue("UserID")));
            //发送邮件到Internet地址

            //FengGu.Common.MailSender.Send(MySMTPModel.SMTPServer, MySMTPModel.SMTPFromEmail, MyModel.ToUser, MyModel.EmailTitle, MyModel.EmailContent, true, Encoding.UTF8, true, MyModel.FuJian);
            Pop3ForJmail.SendMail(MySMTPModel.SMTPUserName, MySMTPModel.SMTPUserPwd, MySMTPModel.SMTPServer, MyModel.EmailTitle, MyModel.EmailContent, MySMTPModel.SMTPFromEmail, MyModel.ToUser, MyModel.FuJian);

            MyModel.Add();

            ZWL.Common.MessageBox.ShowAndRedirect(this, "Internet邮件添加成功!", "NetMailShou.aspx");
        }
        catch
        {
            MyModel.EmailState = "草稿";

            MyModel.Add();

            Response.Write("<script>alert('发送邮件时发生错误,请检查您的邮件参数设置是否正确!已保存至草稿!');</script>");
        }
        //写系统日志
        ZWL.BLL.ERPRiZhi MyRiZhi = new ZWL.BLL.ERPRiZhi();
        MyRiZhi.UserName    = ZWL.Common.PublicMethod.GetSessionValue("UserName");
        MyRiZhi.DoSomething = "用户添加新邮件(" + this.TextBox1.Text + ")";
        MyRiZhi.IpStr       = System.Web.HttpContext.Current.Request.UserHostAddress.ToString();
        MyRiZhi.Add();
    }
Beispiel #2
0
    protected void ImageButton2_Click(object sender, EventArgs e)
    {
        string IDlist = ZWL.Common.PublicMethod.CheckCbx(this.GVData, "CheckSelect", "LabVisible");

        if (ZWL.DBUtility.DbHelperSQL.ExecuteSQL("update ERPNetEmail set EmailState='已发' where ID in (" + IDlist + ")") == -1)
        {
            Response.Write("<script>alert('发送邮件时发生错误!请重新登陆后重试!');</script>");
        }
        else
        {
            string[] IDArray = IDlist.Split(',');
            for (int jk = 0; jk < IDArray.Length; jk++)
            {
                if (IDArray[jk].Trim().Length > 0 && IDArray[jk].Trim() != "0")
                {
                    ZWL.BLL.ERPNetEmail MyModel = new ZWL.BLL.ERPNetEmail();
                    MyModel.GetModel(int.Parse(IDArray[jk].Trim()));
                    //Jmail发送邮件到InterNet
                    ZWL.BLL.ERPPOPAndSMTP MySMTPModel = new ZWL.BLL.ERPPOPAndSMTP();
                    MySMTPModel.GetModel(int.Parse(ZWL.Common.PublicMethod.GetSessionValue("UserID")));
                    //发送邮件到Internet地址
                    try
                    {
                        Pop3ForJmail.SendMail(MySMTPModel.SMTPUserName, MySMTPModel.SMTPUserPwd, MySMTPModel.SMTPServer, MyModel.EmailTitle, MyModel.EmailContent, MySMTPModel.SMTPFromEmail, MyModel.ToUser, MyModel.FuJian);
                    }
                    catch
                    {
                        //Response.Write("<script>alert('发送邮件时发生错误,请检查您的邮件参数设置是否正确!');</script>");
                    }
                }
            }

            DataBindToGridview();
            //写系统日志
            ZWL.BLL.ERPRiZhi MyRiZhi = new ZWL.BLL.ERPRiZhi();
            MyRiZhi.UserName    = ZWL.Common.PublicMethod.GetSessionValue("UserName");
            MyRiZhi.DoSomething = "用户发送草稿箱中的邮件";
            MyRiZhi.IpStr       = System.Web.HttpContext.Current.Request.UserHostAddress.ToString();
            MyRiZhi.Add();

            Response.Write("<script>alert('邮件发送完毕!');</script>");
        }
    }
Beispiel #3
0
    protected void ImageButton1_Click(object sender, EventArgs e)
    {
        ZWL.BLL.ERPNetEmail MyModel = new ZWL.BLL.ERPNetEmail();
        MyModel.EmailTitle   = this.TextBox1.Text;
        MyModel.EmailContent = this.TxtContent.Value;
        MyModel.FuJian       = ZWL.Common.PublicMethod.GetSessionValue("WenJianList");
        MyModel.FromUser     = ZWL.Common.PublicMethod.GetSessionValue("UserName");
        MyModel.EmailState   = "已发";
        MyModel.TimeStr      = DateTime.Now;
        string[] ToWhoList = this.TextBox2.Text.Trim().Split(',');
        for (int i = 0; i < ToWhoList.Length; i++)
        {
            if (ToWhoList[i].Trim().Length > 0)
            {
                MyModel.ToUser = ToWhoList[i].Trim();
                MyModel.Add();

                //获取现有设置
                ZWL.BLL.ERPPOPAndSMTP MySMTPModel = new ZWL.BLL.ERPPOPAndSMTP();
                MySMTPModel.GetModel(int.Parse(ZWL.Common.PublicMethod.GetSessionValue("UserID")));
                //发送邮件到Internet地址
                try
                {
                    Pop3ForJmail.SendMail(MySMTPModel.SMTPUserName, MySMTPModel.SMTPUserPwd, MySMTPModel.SMTPServer, MyModel.EmailTitle, MyModel.EmailContent, MySMTPModel.SMTPFromEmail, MyModel.ToUser, MyModel.FuJian);
                }
                catch
                {
                    Response.Write("<script>alert('发送邮件时发生错误,请检查您的邮件参数设置是否正确!');</script>");
                }
            }
        }
        //写系统日志
        ZWL.BLL.ERPRiZhi MyRiZhi = new ZWL.BLL.ERPRiZhi();
        MyRiZhi.UserName    = ZWL.Common.PublicMethod.GetSessionValue("UserName");
        MyRiZhi.DoSomething = "用户添加新邮件(" + this.TextBox1.Text + ")";
        MyRiZhi.IpStr       = System.Web.HttpContext.Current.Request.UserHostAddress.ToString();
        MyRiZhi.Add();

        ZWL.Common.MessageBox.ShowAndRedirect(this, "Internet邮件添加成功!", "NetMailShou.aspx");
    }