Beispiel #1
0
        /// <summary>
        /// 发送邮件附件,只包括数据库操作
        /// </summary>
        /// <param name="att">MailAttachFile类</param>
        /// <param name="MailID">邮件ID</param>
        public void AttSend(MailAttachFile att, int MailID)
        {
            Database data = new Database();

            SqlParameter[] prams =
            {
                data.MakeInParam("@MailID",         SqlDbType.Int,       20, MailID),
                data.MakeInParam("@FileName",       SqlDbType.VarChar,  300, att.FileName),
                data.MakeInParam("@FileSize",       SqlDbType.Int,       20, att.FileSize),
                data.MakeInParam("@FileAttribute",  SqlDbType.SmallInt,  20, att.FileAttribute),
                data.MakeInParam("@FileVisualPath", SqlDbType.NVarChar, 200, att.FileVisualPath),
                data.MakeInParam("@FileAuthor",     SqlDbType.NVarChar,  50, att.FileAuthor),
                data.MakeInParam("@FileCatlog",     SqlDbType.NVarChar,  20, att.FileCatlog)
            };
            try
            {
                data.RunProc("SP_AddMailAttFile", prams);
            }
            catch (Exception ex)
            {
                Error.Log(ex.ToString());
                throw new Exception("邮件附件发送出错!", ex);
            }
        }
Beispiel #2
0
 /// <summary>
 /// �����ʼ�������ֻ�������ݿ����
 /// </summary>
 /// <param name="att">MailAttachFile��</param>
 /// <param name="MailID">�ʼ�ID</param>
 public void AttSend(MailAttachFile att,int MailID)
 {
     Database data = new Database();
     SqlParameter[] prams = {
                             data.MakeInParam("@MailID",  SqlDbType.Int, 20, MailID),
                             data.MakeInParam("@FileName",  SqlDbType.VarChar, 300, att.FileName),
                             data.MakeInParam("@FileSize",  SqlDbType.Int, 20, att.FileSize),
                             data.MakeInParam("@FileAttribute",  SqlDbType.SmallInt,20, att.FileAttribute),
                             data.MakeInParam("@FileVisualPath",  SqlDbType.NVarChar, 200, att.FileVisualPath),
                             data.MakeInParam("@FileAuthor",  SqlDbType.NVarChar, 50, att.FileAuthor),
                             data.MakeInParam("@FileCatlog",  SqlDbType.NVarChar, 20, att.FileCatlog)
                            };
     try
     {
         data.RunProc("SP_AddMailAttFile", prams);
     }
     catch (Exception ex)
     {
         Error.Log(ex.ToString());
         throw new Exception("�ʼ��������ͳ���!",ex);
     }
 }
Beispiel #3
0
        /// <summary>
        /// ת���ʼ�����
        /// </summary>
        private void ForwardSet()
        {
            // ��ȡԭ�ʼ�����
            MailClass mailclass = new MailClass();
            SqlDataReader dataReader = null;

            try
            {
                try
                {
                    dataReader = mailclass.GetMailCompleteInfoDbreader(MailID);
                }
                catch
                {
                    Server.Transfer("../../Error.aspx");
                }

                if (dataReader.Read())
                {
                    string tmpStr = "<br/>" + dataReader[7].ToString();
                    tmpStr = tmpStr.Replace("<br/>", "\r\n>");
                    this.txtSubject.Text = "Fw::" + dataReader[4].ToString();
                    this.txtBody.Text = ",���!\n\n\n\n\n\n\n";
                    this.txtBody.Text += "=======������ת���ʼ�=======\n";
                    this.txtBody.Text += "ԭ�ʼ�����������:" + dataReader[1].ToString() + "\n";
                    this.txtBody.Text += "ԭ�ʼ������˴���:" + dataReader[10].ToString() + "\n";
                    this.txtBody.Text += tmpStr;

                }
                dataReader.Close();

                try
                {
                    dataReader = mailclass.GetMailAttInfoDbreader(MailID);
                }
                catch
                {
                    Server.Transfer("../../Error.aspx");
                }
                while (dataReader.Read())
                {
                    UDS.Components.MailAttachFile att = new MailAttachFile();
                    att.FileAttribute = 0;
                    att.FileSize = Int32.Parse(dataReader[1].ToString());
                    att.FileName = dataReader[0].ToString();
                    att.FileAuthor = Username;
                    att.FileCatlog = "�ʼ�";
                    att.FileVisualPath = dataReader[2].ToString();
                    upattlist.Add(att);
                }
                BindAttList();

            }
            finally
            {
                dataReader.Close();

            }
            mailclass = null;
        }
Beispiel #4
0
        /// <summary>
        /// �����ϴ�����,������������ʽ���
        /// </summary>
        /// <param name="MailReceiverStr"> �û���½���ַ������ö��Ÿ�� </param>
        private ArrayList AttUpload(string MailReceiverStr)
        {
            HtmlForm FrmCompose   = (HtmlForm)this.Page.FindControl("Compose");
            string[] RecvIdAr     = System.Text.RegularExpressions.Regex.Split(MailReceiverStr ,",");
            ArrayList listattfile = new ArrayList();
            // ��Ÿ�����������Ŀ¼�У��������Ŀ¼��
            Random TempNameInt    = new Random();
            string NewMailDirName = TempNameInt.Next(100000000).ToString();
            string FileName       = "";
            try
            {
                if(!Directory.Exists(Server.MapPath(".")+"\\AttachFiles\\"+Username))
                    Directory.CreateDirectory(Server.MapPath(".")+"\\AttachFiles\\"+Username);

                    Directory.CreateDirectory(Server.MapPath(".")+"\\AttachFiles\\"+Username+"\\"+NewMailDirName);
                    for (int i=0;i<FrmCompose.Controls.Count;i++)
                    {
                        if(FrmCompose.Controls [i].GetType().ToString()=="System.Web.UI.HtmlControls.HtmlInputFile")
                        {
                            HtmlInputFile hif = ((HtmlInputFile)(FrmCompose.Controls[i]));
                            if(hif.PostedFile.FileName.Trim()!="")
                            {
                                FileName = System.IO .Path.GetFileName(hif.PostedFile.FileName);
                                UDS.Components.MailAttachFile att = new MailAttachFile();
                                // ��ʼ��
                                att.FileAttribute  = 0;
                                att.FileSize       = hif.PostedFile.ContentLength;
                                att.FileName	   = FileName;
                                att.FileAuthor     = Username;
                                att.FileCatlog     = "�ʼ�";
                                att.FileVisualPath = "\\AttachFiles\\"+Username+"\\"+NewMailDirName+"\\"+FileName;
                                hif.PostedFile.SaveAs(Server.MapPath(".")+"\\AttachFiles\\"+Username+"\\"+NewMailDirName+"\\"+FileName);
                                listattfile.Add(att);
                            }
                            hif=null;
                        }
                    }

            }
            catch(Exception ioex)
            {
                UDS.Components.Error.Log(ioex.ToString());
                Server.Transfer("../../Error.aspx");
            }

            return listattfile;
        }
Beispiel #5
0
        private void btnUpload_Click(object sender, System.EventArgs e)
        {
            HtmlForm FrmCompose   = (HtmlForm)this.Page.FindControl("Compose");
            Random TempNameInt    = new Random();
            string NewMailDirName  = TempNameInt.Next(100000000).ToString();
            // ��Ÿ������ύ��Ŀ¼�У��������Ŀ¼��
            ArrayList upattlist = (ArrayList)Session["upattlist"];
            string FileName       = "";
            try
            {
                if(!Directory.Exists(Server.MapPath(".")+"\\AttachFiles\\tmp"))
                    Directory.CreateDirectory(Server.MapPath(".")+"\\AttachFiles\\tmp");

                    Directory.CreateDirectory(Server.MapPath(".")+"\\AttachFiles\\tmp\\"+NewMailDirName+Username);
                    for (int i=0;i<FrmCompose.Controls.Count;i++)
                    {
                        if(FrmCompose.Controls [i].GetType().ToString()=="System.Web.UI.HtmlControls.HtmlInputFile")
                        {

                            HtmlInputFile hif = ((HtmlInputFile)(FrmCompose.Controls[i]));
                            if(hif.PostedFile.FileName.Trim()!="")
                            {
                                FileName = System.IO .Path.GetFileName(hif.PostedFile.FileName);
                                UDS.Components.MailAttachFile att = new MailAttachFile();
                                // ��ʼ��
                                att.FileAttribute  = 0;
                                att.FileSize       = hif.PostedFile.ContentLength;
                                att.FileName	   = FileName;
                                att.FileAuthor     = Username;
                                att.FileCatlog     = "�ʼ�";
                                att.FileVisualPath = "\\AttachFiles\\tmp\\"+NewMailDirName+Username+"\\"+FileName;
                                hif.PostedFile.SaveAs(Server.MapPath(".")+"\\AttachFiles\\tmp\\"+NewMailDirName+Username+"\\"+FileName);
                                upattlist.Add(att);

                            }
                            hif=null;
                        }
                    }
                Session["upattlist"] = upattlist;
                BindAttList();
                this.SendToRealName       = Request.Form["txtSendTo"].ToString();
                this.SendTo				  = Request.Form["hdnTxtSendTo"].ToString();
                this.CcTo				  = Request.Form["hdnTxtCcTo"].ToString();
                this.BccTo				  = Request.Form["hdnTxtBccTo"].ToString();
                this.CcToRealName         = Request.Form["txtCcTo"].ToString();
                this.BccToRealName        = Request.Form["txtBccTo"].ToString();
            }
            catch(Exception ioex)
            {
                UDS.Components.Error.Log(ioex.ToString());
                Server.Transfer("../../Error.aspx");
            }
        }