예제 #1
0
 public void MarkAsUnread(object sender, System.Web.UI.WebControls.CommandEventArgs e)
 {
     try
     {
         ActiveUp.Net.Mail.Mailbox        mailbox        = ((ActiveUp.Net.Mail.Imap4Client)Session["imapobject\uFFFD"]).SelectMailbox(MailboxName);
         ActiveUp.Net.Mail.FlagCollection flagCollection = new ActiveUp.Net.Mail.FlagCollection();
         flagCollection.Add("Seen\uFFFD");
         EnvelopeCollection envelopeCollection = EnvelopeCollection.Load(Page.Server.MapPath(Application["writedirectory\uFFFD"].ToString() + Session["login\uFFFD"] + "_\uFFFD" + Server.UrlEncode(mailbox.Name) + ".xml\uFFFD"));
         if (mailbox.Fetch.Flags(MessageId).Merged.IndexOf("\\seen\uFFFD") != -1)
         {
             mailbox.RemoveFlagsSilent(MessageId, flagCollection);
             envelopeCollection[envelopeCollection.Count - MessageId].Read = false;
         }
         else
         {
             mailbox.AddFlagsSilent(MessageId, flagCollection);
             envelopeCollection[envelopeCollection.Count - MessageId].Read = true;
         }
         envelopeCollection.Save(Page.Server.MapPath(Application["writedirectory\uFFFD"].ToString() + Session["login\uFFFD"] + "_\uFFFD" + Server.UrlEncode(mailbox.Name) + ".xml\uFFFD"));
         //BoundMailboxContent.MailboxName = mailbox.Name;
         //BoundMailboxContent.LoadMailbox(envelopeCollection, true);
     }
     catch (System.Exception e1)
     {
         Page.RegisterStartupScript("ShowError\uFFFD", "<script>ShowErrorDialog('\uFFFD" + ((Language)Session["language\uFFFD"]).Words[94].ToString() + "','\uFFFD" + System.Text.RegularExpressions.Regex.Escape(e1.Message + e1.StackTrace).Replace("'\uFFFD", "\\'\uFFFD") + "');</script>\uFFFD");
     }
 }
예제 #2
0
    private void Page_Load(object sender, System.EventArgs e)
    {
        System.DateTime dateTime = System.DateTime.Now;
        string          s1       = "Message_Backup_\uFFFD" + dateTime.ToString("ddMMyy_HHmmss\uFFFD") + ".zip\uFFFD";

        System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
        ICSharpCode.SharpZipLib.Zip.ZipOutputStream zipOutputStream = new ICSharpCode.SharpZipLib.Zip.ZipOutputStream(memoryStream);
        ActiveUp.Net.Mail.Mailbox mailbox = ((ActiveUp.Net.Mail.Imap4Client)Session["imapobject\uFFFD"]).SelectMailbox(Request.QueryString["b\uFFFD"]);
        char[]   chArr = new char[] { ',' };
        string[] sArr  = Request.QueryString["m\uFFFD"].Split(chArr);
        for (int i = 0; i < sArr.Length; i++)
        {
            string s2   = sArr[i];
            byte[] bArr = mailbox.Fetch.Message(System.Convert.ToInt32(s2));
            ActiveUp.Net.Mail.Header             header   = ActiveUp.Net.Mail.Parser.ParseHeader(bArr);
            ICSharpCode.SharpZipLib.Zip.ZipEntry zipEntry = new ICSharpCode.SharpZipLib.Zip.ZipEntry(header.Subject + ".eml\uFFFD");
            zipOutputStream.PutNextEntry(zipEntry);
            zipOutputStream.SetLevel(9);
            zipOutputStream.Write(bArr, 0, bArr.Length);
            zipOutputStream.CloseEntry();
        }
        zipOutputStream.Finish();
        Response.AddHeader("Content-Disposition\uFFFD", "attachment; filename=\uFFFD" + s1);
        Response.ContentType = "application/zip\uFFFD";
        Response.BinaryWrite(memoryStream.GetBuffer());
        zipOutputStream.Close();
    }
예제 #3
0
 public void Move(object sender, System.Web.UI.WebControls.CommandEventArgs e)
 {
     try
     {
         ActiveUp.Net.Mail.Mailbox mailbox = ((ActiveUp.Net.Mail.Imap4Client)Session["imapobject\uFFFD"]).SelectMailbox(MailboxName);
         // if (!System.IO.File.Exists(Page.Server.MapPath(Application["writedirectory\uFFFD"].ToString() + Session["login\uFFFD"] + "_\uFFFD" + Server.UrlEncode(this._boundTopNav.DBoxesItem) + ".xml\uFFFD")))
         //this._boundMailboxContent.Cache(this._boundTopNav.DBoxesItem);
         EnvelopeCollection envelopeCollection1 = EnvelopeCollection.Load(Page.Server.MapPath(Application["writedirectory\uFFFD"].ToString() + Session["login\uFFFD"] + "_\uFFFD" + Server.UrlEncode(mailbox.Name) + ".xml\uFFFD"));
         //EnvelopeCollection envelopeCollection2 = EnvelopeCollection.Load(Page.Server.MapPath(Application["writedirectory\uFFFD"].ToString() + Session["login\uFFFD"] + "_\uFFFD" + Server.UrlEncode(this._boundTopNav.DBoxesItem + ".xml\uFFFD")));
         //mailbox.CopyMessage(MessageId, this._boundTopNav.DBoxesItem);
         Envelope envelope = new Envelope(envelopeCollection1[envelopeCollection1.Count - MessageId]);
         //envelope.Mailbox = this._boundTopNav.DBoxesItem;
         //envelope.Id = envelopeCollection2.Count + 1;
         //if (envelopeCollection2.Count != 0)
         //  envelopeCollection2.Insert(envelope, 0);
         //else
         //   envelopeCollection2.Add(envelope);
         // envelopeCollection2.Save(Page.Server.MapPath(Application["writedirectory\uFFFD"].ToString() + Session["login\uFFFD"] + "_\uFFFD" + Server.UrlEncode(this._boundTopNav.DBoxesItem) + ".xml\uFFFD"));
         LoadMessage((string)Application["server\uFFFD"], (string)Application["user\uFFFD"], mailbox.Name, MessageId, true);
     }
     catch (System.Exception e1)
     {
         Page.RegisterStartupScript("ShowError\uFFFD", "<script>ShowErrorDialog('\uFFFD" + ((Language)Session["language\uFFFD"]).Words[87].ToString() + "','\uFFFD" + System.Text.RegularExpressions.Regex.Escape(e1.Message + e1.StackTrace).Replace("'\uFFFD", "\\'\uFFFD") + "');</script>\uFFFD");
     }
 }
예제 #4
0
 private void Page_Load(object sender, System.EventArgs e)
 {
     ActiveUp.Net.Mail.MimePartCollection attachmentCollection = new ActiveUp.Net.Mail.MimePartCollection();
     ActiveUp.Net.Mail.Mailbox            mailbox = ((ActiveUp.Net.Mail.Imap4Client)Session["imapobject\uFFFD"]).SelectMailbox(Request.QueryString["b\uFFFD"]);
     ActiveUp.Net.Mail.Message            message = mailbox.Fetch.MessageObject(System.Convert.ToInt32(Request.QueryString["m\uFFFD"]));
     attachmentCollection = message.Attachments;
     if (Request.QueryString["f\uFFFD"].EndsWith(".eml\uFFFD"))
     {
         foreach (ActiveUp.Net.Mail.MimePart attachment1 in attachmentCollection)
         {
             if (attachment1.ContentType.MimeType == "message/rfc822\uFFFD" && ActiveUp.Net.Mail.Parser.ParseHeader(attachment1.BinaryContent).Subject == Request.QueryString["f\uFFFD"].Substring(0, Request.QueryString["f\uFFFD"].Length - 4))
             {
                 Response.AddHeader("Content-Disposition\uFFFD", "attachment; filename=\uFFFD" + Request.QueryString["f\uFFFD"]);
                 Response.ContentType = attachment1.ContentType.MimeType;
                 Response.BinaryWrite(attachment1.BinaryContent);
             }
         }
     }
     foreach (ActiveUp.Net.Mail.MimePart attachment2 in attachmentCollection)
     {
         if (attachment2.Filename == Server.HtmlDecode(Request.QueryString["f\uFFFD"]) || attachment2.ContentName == Server.HtmlDecode(Request.QueryString["f\uFFFD"]))
         {
             string s = attachment2.Filename == Server.HtmlDecode(Request.QueryString["f\uFFFD"]) ? attachment2.Filename : attachment2.ContentName;
             Response.AddHeader("Content-Disposition\uFFFD", "attachment; filename=\uFFFD" + s);
             Response.ContentType = attachment2.ContentType.MimeType;
             Response.BinaryWrite(attachment2.BinaryContent);
         }
     }
 }
예제 #5
0
    public void SearchQuick(object sender, System.EventArgs e)
    {
        int i1;

        try
        {
            EnvelopeCollection envelopeCollection = new EnvelopeCollection();
            string             s = "OR FROM \"\uFFFD" + iQuick.Text + "\" (OR TO \"\uFFFD" + iQuick.Text + "\" (OR CC \"\uFFFD" + iQuick.Text + "\" (OR SUBJECT \"\uFFFD" + iQuick.Text + "\" BODY \"\uFFFD" + iQuick.Text + "\")))\uFFFD";
            for (i1 = 0; i1 < (dBoxes.Items.Count - 1); i1++)
            {
                ActiveUp.Net.Mail.Mailbox mailbox = ((ActiveUp.Net.Mail.Imap4Client)Session["imapobject\uFFFD"]).SelectMailbox(dBoxes.Items[i1 + 1].Text);
                int[] iArr1 = mailbox.Search(s);
                int[] iArr2 = iArr1;
                for (int i3 = 0; i3 < iArr2.Length; i3++)
                {
                    int      i2       = iArr2[i3];
                    Envelope envelope = new Envelope();
                    string[] sArr3    = new string[] {
                        "grun\uFFFD",
                        "subject\uFFFD",
                        "from\uFFFD",
                        "date\uFFFD"
                    };
                    System.Collections.Specialized.NameValueCollection nameValueCollection = mailbox.Fetch.HeaderLines(i2, sArr3);
                    ActiveUp.Net.Mail.FlagCollection flagCollection = mailbox.Fetch.Flags(i2);
                    envelope.Read      = flagCollection.Merged.IndexOf("\\seen\uFFFD") != -1;
                    envelope.Answered  = flagCollection.Merged.IndexOf("\\answered\uFFFD") != -1;
                    envelope.Forwarded = flagCollection.Merged.IndexOf("\\forwarded\uFFFD") != -1;
                    envelope.Marked    = flagCollection.Merged.IndexOf("\\flagged\uFFFD") != -1;
                    envelope.Subject   = nameValueCollection["subject\uFFFD"];
                    envelope.From      = ActiveUp.Net.Mail.Parser.ParseAddresses(nameValueCollection["from\uFFFD"])[0];
                    char[]   chArr1 = new char[] { ' ' };
                    string[] sArr1  = nameValueCollection["date\uFFFD"].Split(chArr1);
                    char[]   chArr2 = new char[] { ':' };
                    char[]   chArr3 = new char[] { ':' };
                    char[]   chArr4 = new char[] { ':' };
                    //envelope.Date = new System.DateTime(System.Convert.ToInt32(sArr1[3]), BoundMailboxContent.GetMonth(sArr1[2]), System.Convert.ToInt32(sArr1[1]), System.Convert.ToInt32(sArr1[4].Split(chArr2)[0]), System.Convert.ToInt32(sArr1[4].Split(chArr3)[1]), System.Convert.ToInt32(sArr1[4].Split(chArr4)[2]));
                    envelope.Size    = mailbox.Fetch.Size(i2);
                    envelope.Id      = i2;
                    envelope.Mailbox = mailbox.Name;
                    envelopeCollection.Add(envelope);
                }
            }
            //this._boundMailboxContent.LoadMailbox(envelopeCollection, false);
            //this._boundMailboxContent.LFolderText = ((Language)Session["language\uFFFD"]).Words[107].ToString();
            //((System.Web.UI.HtmlControls.HtmlInputCheckBox)this._boundMailboxContent.DMailBoxControl).Disabled = true;
            //BoundMailboxContent.Visible = true;
        }
        catch (System.Exception e1)
        {
            Page.RegisterStartupScript("ShowError\uFFFD", "<script>ShowErrorDialog('\uFFFD" + ((Language)Session["language\uFFFD"]).Words[95].ToString() + "','\uFFFD" + System.Text.RegularExpressions.Regex.Escape(e1.Message + e1.StackTrace).Replace("'\uFFFD", "\\'\uFFFD") + "');</script>\uFFFD");
        }
    }
예제 #6
0
 private void PutChild(ActiveUp.Net.Mail.Mailbox box)
 {
     foreach (ActiveUp.Net.Mail.Mailbox mailbox in box.SubMailboxes)
     {
         if (mailbox.Name.Replace(box.Name + "/\uFFFD", "\uFFFD").IndexOf("/\uFFFD") == -1)
         {
             ActiveUp.WebControls.TreeNode treeNode = tree.FindNode(box.Name).AddNode(mailbox.Name, "<span class=\"foldername\">\uFFFD" + mailbox.ShortName + "</span>\uFFFD", System.String.Empty);
             treeNode.Click += new System.EventHandler(Navigate);
             PutChild(mailbox);
         }
     }
 }
예제 #7
0
 public void Cache(string mailboxName)
 {
     try
     {
         ActiveUp.Net.Mail.Mailbox mailbox             = ((ActiveUp.Net.Mail.Imap4Client)Session["imapobject\uFFFD"]).SelectMailbox(mailboxName);
         EnvelopeCollection        envelopeCollection1 = new EnvelopeCollection();
         EnvelopeCollection        envelopeCollection2 = new EnvelopeCollection();
         for (int i1 = 1; i1 <= mailbox.MessageCount; i1++)
         {
             Envelope envelope = new Envelope();
             string[] sArr2    = new string[] {
                 "grun\uFFFD",
                 "subject\uFFFD",
                 "from\uFFFD",
                 "date\uFFFD"
             };
             System.Collections.Specialized.NameValueCollection nameValueCollection = mailbox.Fetch.HeaderLinesPeek(i1, sArr2);
             ActiveUp.Net.Mail.FlagCollection flagCollection = mailbox.Fetch.Flags(i1);
             envelope.Read      = flagCollection.Merged.IndexOf("\\seen\uFFFD") != -1;
             envelope.Answered  = flagCollection.Merged.IndexOf("\\answered\uFFFD") != -1;
             envelope.Forwarded = flagCollection.Merged.IndexOf("\\forwarded\uFFFD") != -1;
             envelope.Marked    = flagCollection.Merged.IndexOf("\\flagged\uFFFD") != -1;
             envelope.Subject   = nameValueCollection["subject\uFFFD"];
             envelope.From      = ActiveUp.Net.Mail.Parser.ParseAddresses(nameValueCollection["from\uFFFD"])[0];
             char[]   chArr1 = new char[] { ' ' };
             string[] sArr1  = nameValueCollection["date\uFFFD"].Split(chArr1);
             char[]   chArr2 = new char[] { ':' };
             char[]   chArr3 = new char[] { ':' };
             char[]   chArr4 = new char[] { ':' };
             envelope.Date    = new System.DateTime(System.Convert.ToInt32(sArr1[3]), GetMonth(sArr1[2]), System.Convert.ToInt32(sArr1[1]), System.Convert.ToInt32(sArr1[4].Split(chArr2)[0]), System.Convert.ToInt32(sArr1[4].Split(chArr3)[1]), System.Convert.ToInt32(sArr1[4].Split(chArr4)[2]));
             envelope.Size    = mailbox.Fetch.Size(i1);
             envelope.Mailbox = mailbox.Name;
             envelope.Id      = i1;
             envelopeCollection1.Add(envelope);
         }
         for (int i2 = envelopeCollection1.Count - 1; i2 >= 0; i2--)
         {
             envelopeCollection2.Add(envelopeCollection1[i2]);
         }
         envelopeCollection2.Save(Page.Server.MapPath(Application["writedirectory\uFFFD"].ToString() + Session["login\uFFFD"] + "_\uFFFD" + Server.UrlEncode(mailbox.Name) + ".xml\uFFFD"));
     }
     catch (System.Exception e)
     {
         Page.RegisterStartupScript("ShowError\uFFFD", "<script>ShowErrorDialog('\uFFFD" + ((Language)Session["language\uFFFD"]).Words[93].ToString() + "','\uFFFD" + System.Text.RegularExpressions.Regex.Escape(e.Message + e.StackTrace).Replace("'\uFFFD", "\\'\uFFFD") + "');</script>\uFFFD");
     }
 }
예제 #8
0
    public void Delete(object sender, System.Web.UI.WebControls.CommandEventArgs e)
    {
        int i;

        try
        {
            ActiveUp.Net.Mail.Mailbox mailbox            = ((ActiveUp.Net.Mail.Imap4Client)Session["imapobject\uFFFD"]).SelectMailbox(MailboxName);
            EnvelopeCollection        envelopeCollection = EnvelopeCollection.Load(Page.Server.MapPath(Application["writedirectory\uFFFD"].ToString() + Session["login\uFFFD"] + "_\uFFFD" + Server.UrlEncode(mailbox.Name) + ".xml\uFFFD"));
            mailbox.DeleteMessage(MessageId, false);
            mailbox.SourceClient.Expunge();
            envelopeCollection.RemoveAt(envelopeCollection.Count - MessageId);
            for (i = 0; i < (envelopeCollection.Count - MessageId); i++)
            {
                envelopeCollection[i].Id--;
            }
            envelopeCollection.Save(Page.Server.MapPath(Application["writedirectory\uFFFD"].ToString() + Session["login\uFFFD"] + "_\uFFFD" + Server.UrlEncode(mailbox.Name) + ".xml\uFFFD"));
            //BoundMailboxContent.MailboxName = mailbox.Name;
            //BoundMailboxContent.LoadMailbox(envelopeCollection, true);
        }
        catch (System.Exception e1)
        {
            Page.RegisterStartupScript("ShowError\uFFFD", "<script>ShowErrorDialog('\uFFFD" + ((Language)Session["language\uFFFD"]).Words[85].ToString() + "','\uFFFD" + System.Text.RegularExpressions.Regex.Escape(e1.Message + e1.StackTrace).Replace("'\uFFFD", "\\'\uFFFD") + "');</script>\uFFFD");
        }
    }
예제 #9
0
 /// <summary>
 /// Adds the provided mailbox to the collection.
 /// </summary>
 /// <param name="mailbox">The mailbox to be added.</param>
 public void Add(ActiveUp.Net.Mail.Mailbox mailbox)
 {
     this.List.Add(mailbox);
 }
예제 #10
0
 public void Send(object sender, System.EventArgs e)
 {
     ActiveUp.Net.Mail.Message message = new ActiveUp.Net.Mail.Message();
     try
     {
         message.Subject = iSubject.Text;
         message.To      = ActiveUp.Net.Mail.Parser.ParseAddresses(iTo.Text);
         message.Cc      = ActiveUp.Net.Mail.Parser.ParseAddresses(iCc.Text);
         message.Bcc     = ActiveUp.Net.Mail.Parser.ParseAddresses(iBcc.Text);
         if (iReplyTo.Text.Length > 0)
         {
             message.ReplyTo = ActiveUp.Net.Mail.Parser.ParseAddresses(iReplyTo.Text)[0];
         }
         string   s1    = iBody.Text;
         string[] sArr1 = System.IO.Directory.GetFiles(Page.Server.MapPath(Application["writedirectory\uFFFD"].ToString()));
         for (int i1 = 0; i1 < sArr1.Length; i1++)
         {
             string s2 = sArr1[i1];
             if ((s2.IndexOf(Session.SessionID + "_Image_\uFFFD") != -1) && (s1.IndexOf(s2.Substring(s2.IndexOf(Session.SessionID))) != -1))
             {
                 ActiveUp.Net.Mail.MimePart embeddedObject1 = new ActiveUp.Net.Mail.MimePart(s2, true, string.Empty);
                 embeddedObject1.ContentName = s2.Substring(s2.IndexOf("_Image_\uFFFD") + 7);
                 message.EmbeddedObjects.Add(embeddedObject1);
                 s1 = s1.Replace("http://\uFFFD" + Request.ServerVariables["HTTP_HOST\uFFFD"] + Request.ServerVariables["URL\uFFFD"].Substring(0, Request.ServerVariables["URL\uFFFD"].LastIndexOf("/\uFFFD") + 1) + "temp\uFFFD" + s2.Substring(s2.LastIndexOf('\\')).Replace("\\\uFFFD", "/\uFFFD"), "cid:\uFFFD" + embeddedObject1.ContentId);
                 s1 = s1.Replace("temp\uFFFD" + s2.Substring(s2.LastIndexOf('\\')).Replace("\\\uFFFD", "/\uFFFD"), "cid:\uFFFD" + embeddedObject1.ContentId);
             }
         }
         string[] sArr3 = System.IO.Directory.GetFiles(Server.MapPath("icons/emoticons/\uFFFD"));
         for (int i2 = 0; i2 < sArr3.Length; i2++)
         {
             string s3 = sArr3[i2];
             if (s1.IndexOf("icons/emoticons\uFFFD" + s3.Substring(s3.LastIndexOf("\\\uFFFD")).Replace("\\\uFFFD", "/\uFFFD")) != -1)
             {
                 ActiveUp.Net.Mail.MimePart embeddedObject2 = new ActiveUp.Net.Mail.MimePart(s3, true, string.Empty);
                 embeddedObject2.ContentName = s3.Substring(s3.LastIndexOf("\\\uFFFD") + 1);
                 message.EmbeddedObjects.Add(embeddedObject2);
                 s1 = s1.Replace("http://\uFFFD" + Request.ServerVariables["HTTP_HOST\uFFFD"] + Request.ServerVariables["URL\uFFFD"].Substring(0, Request.ServerVariables["URL\uFFFD"].LastIndexOf("/\uFFFD") + 1) + "icons/emoticons\uFFFD" + s3.Substring(s3.LastIndexOf('\\')).Replace("\\\uFFFD", "/\uFFFD"), "cid:\uFFFD" + embeddedObject2.ContentId);
             }
         }
         message.BodyHtml.Text = s1;
         message.BodyText.Text = iBody.TextStripped;
         //message.Headers.Add("x-sender-ip\uFFFD", Request.ServerVariables["REMOTE_ADDR\uFFFD"]);
         string[] sArr5 = System.IO.Directory.GetFiles(Page.Server.MapPath(Application["writedirectory\uFFFD"].ToString()));
         for (int i3 = 0; i3 < sArr5.Length; i3++)
         {
             string s4 = sArr5[i3];
             if (s4.IndexOf("\\temp\\\uFFFD" + Session.SessionID + "_Attach_\uFFFD") != -1)
             {
                 ActiveUp.Net.Mail.MimePart attachment = new ActiveUp.Net.Mail.MimePart(s4, true);
                 attachment.Filename    = s4.Substring(s4.IndexOf("_Attach_\uFFFD") + 8);
                 attachment.ContentName = s4.Substring(s4.IndexOf("_Attach_\uFFFD") + 8);
                 message.Attachments.Add(attachment);
             }
         }
         message.From = new ActiveUp.Net.Mail.Address(iFromEmail.Text, iFromName.Text);
         if (((System.Web.UI.HtmlControls.HtmlInputButton)sender).ID == "iSubmit\uFFFD")
         {
             try
             {
                 message.Send((string)Application["smtpserver\uFFFD"], System.Convert.ToInt32(Application["smtpport\uFFFD"]), (string)Application["user\uFFFD"], (string)Application["password\uFFFD"], ActiveUp.Net.Mail.SaslMechanism.CramMd5);
             }
             catch
             {
                 try
                 {
                     message.Send((string)Application["smtpserver\uFFFD"], System.Convert.ToInt32(Application["smtpport\uFFFD"]), (string)Application["user\uFFFD"], (string)Application["password\uFFFD"], ActiveUp.Net.Mail.SaslMechanism.CramMd5);
                 }
                 catch
                 {
                     message.Send((string)Application["smtpserver\uFFFD"], System.Convert.ToInt32(Application["smtpport\uFFFD"]));
                 }
             }
             try
             {
                 if (iAction.Value == "r\uFFFD")
                 {
                     ActiveUp.Net.Mail.Mailbox        mailbox1       = ((ActiveUp.Net.Mail.Imap4Client)Session["imapobject\uFFFD"]).SelectMailbox(MailboxName);
                     ActiveUp.Net.Mail.FlagCollection flagCollection = new ActiveUp.Net.Mail.FlagCollection();
                     flagCollection.Add("Answered\uFFFD");
                     if (mailbox1.Fetch.Flags(MessageId).Merged.ToLower().IndexOf("\\answered\uFFFD") == -1)
                     {
                         mailbox1.AddFlagsSilent(MessageId, flagCollection);
                     }
                 }
                 lConfirm.Text    = ((Language)Session["language\uFFFD"]).Words[32].ToString() + " : <br /><br />\uFFFD" + message.To.Merged + message.Cc.Merged + message.Bcc.Merged.Replace(";\uFFFD", "<br />\uFFFD");
                 pForm.Visible    = false;
                 pConfirm.Visible = true;
                 System.Web.HttpCookie httpCookie1 = new System.Web.HttpCookie("fromname\uFFFD", iFromName.Text);
                 System.Web.HttpCookie httpCookie2 = new System.Web.HttpCookie("fromemail\uFFFD", iFromEmail.Text);
                 System.Web.HttpCookie httpCookie3 = new System.Web.HttpCookie("replyto\uFFFD", iReplyTo.Text);
                 System.DateTime       dateTime1   = System.DateTime.Now;
                 httpCookie1.Expires = dateTime1.AddMonths(2);
                 System.DateTime dateTime2 = System.DateTime.Now;
                 httpCookie2.Expires = dateTime2.AddMonths(2);
                 System.DateTime dateTime3 = System.DateTime.Now;
                 httpCookie3.Expires = dateTime3.AddMonths(2);
                 Response.Cookies.Add(httpCookie1);
                 Response.Cookies.Add(httpCookie2);
                 Response.Cookies.Add(httpCookie3);
                 if (cSave.Checked)
                 {
                     System.Web.HttpCookie httpCookie4 = new System.Web.HttpCookie("folder\uFFFD", dBoxes.SelectedItem.Text);
                     System.DateTime       dateTime4   = System.DateTime.Now;
                     httpCookie4.Expires = dateTime4.AddMonths(2);
                     Response.Cookies.Add(httpCookie4);
                     ActiveUp.Net.Mail.Mailbox mailbox2 = ((ActiveUp.Net.Mail.Imap4Client)Session["imapobject\uFFFD"]).SelectMailbox(dBoxes.SelectedItem.Text);
                     mailbox2.Append(message.ToMimeString());
                 }
                 string[] sArr6 = System.IO.Directory.GetFiles(Page.Server.MapPath(Application["writedirectory\uFFFD"].ToString()));
                 for (int i4 = 0; i4 < sArr6.Length; i4++)
                 {
                     string s5 = sArr6[i4];
                     if (s5.IndexOf(Session.SessionID) != -1)
                     {
                         System.IO.File.Delete(s5);
                     }
                 }
             }
             catch (System.Exception e1)
             {
                 Page.RegisterStartupScript("ShowError\uFFFD", "<script>ShowErrorDialog('\uFFFD" + ((Language)Session["language\uFFFD"]).Words[83].ToString() + "','\uFFFD" + System.Text.RegularExpressions.Regex.Escape(e1.Message + e1.StackTrace).Replace("'\uFFFD", "\\'\uFFFD") + "');</script>\uFFFD");
             }
         }
         else
         {
             System.Web.HttpCookie httpCookie5 = new System.Web.HttpCookie("folder\uFFFD", dBoxes.SelectedItem.Text);
             System.DateTime       dateTime5   = System.DateTime.Now;
             httpCookie5.Expires = dateTime5.AddMonths(2);
             Response.Cookies.Add(httpCookie5);
             ActiveUp.Net.Mail.Mailbox mailbox3 = ((ActiveUp.Net.Mail.Imap4Client)Session["imapobject\uFFFD"]).SelectMailbox(dBoxes.SelectedItem.Text);
             mailbox3.Append(message.ToMimeString());
         }
         string[] sArr8 = System.IO.Directory.GetFiles(Page.Server.MapPath(Application["writedirectory\uFFFD"].ToString()));
         for (int i5 = 0; i5 < sArr8.Length; i5++)
         {
             string s6 = sArr8[i5];
             if (s6.IndexOf(Session.SessionID) != -1)
             {
                 System.IO.File.Delete(s6);
             }
         }
     }
     catch (System.Exception e2)
     {
         Page.RegisterStartupScript("ShowError\uFFFD", "<script>ShowErrorDialog('\uFFFD" + ((Language)Session["language\uFFFD"]).Words[82].ToString() + "','\uFFFD" + System.Text.RegularExpressions.Regex.Escape(e2.Message + e2.StackTrace).Replace("'\uFFFD", "\\'\uFFFD") + "');</script>\uFFFD");
     }
 }
예제 #11
0
    public void LoadReply(string server, string username, string mailboxName, int messageId, bool showThisHideBounds)
    {
        try
        {
            string[] sArr1 = System.IO.Directory.GetFiles(Page.Server.MapPath(Application["writedirectory\uFFFD"].ToString()));
            for (int i = 0; i < sArr1.Length; i++)
            {
                string s = sArr1[i];
                if (s.IndexOf(Session.SessionID) != -1)
                {
                    System.IO.File.Delete(s);
                }
            }
            Username    = username;
            ImapServer  = server;
            MessageId   = messageId;
            MailboxName = mailboxName;

            iAction.Value = "r\uFFFD";
            ActiveUp.Net.Mail.Mailbox mailbox = ((ActiveUp.Net.Mail.Imap4Client)Session["imapobject\uFFFD"]).SelectMailbox(MailboxName);
            byte[]         bArr    = mailbox.Fetch.Message(MessageId);
            WebMailMessage message = new WebMailMessage();
            message.Parsed  = ActiveUp.Net.Mail.Parser.ParseMessage(bArr);
            message.Subject = message.Parsed.Subject;
            message.From    = message.Parsed.From;
            if (Request.Cookies["fromemail\uFFFD"] != null)
            {
                iFromEmail.Text = Request.Cookies["fromemail\uFFFD"].Value;
            }
            if (Request.Cookies["fromname\uFFFD"] != null)
            {
                iFromName.Text = Request.Cookies["fromname\uFFFD"].Value;
            }
            if (Request.Cookies["replyto\uFFFD"] != null)
            {
                iReplyTo.Text = Request.Cookies["replyto\uFFFD"].Value;
            }
            if ((Request.Cookies["folder\uFFFD"] != null) && (dBoxes.Items.FindByText(Request.Cookies["folder\uFFFD"].Value) != null))
            {
                dBoxes.Items.FindByText(Request.Cookies["folder\uFFFD"].Value).Selected = true;
            }
            foreach (ActiveUp.Net.Mail.MimePart embeddedObject in message.Parsed.EmbeddedObjects)
            {
                if (embeddedObject.ContentType.MimeType.IndexOf("text\uFFFD") == -1)
                {
                    embeddedObject.StoreToFile(Page.Server.MapPath(Application["writedirectory\uFFFD"].ToString() + Session.SessionID + "_Image_\uFFFD" + embeddedObject.ContentName));
                    message.Parsed.BodyHtml.Text = message.Parsed.BodyHtml.Text.Replace("cid:\uFFFD" + embeddedObject.ContentId, "http://\uFFFD" + Request.ServerVariables["HTTP_HOST\uFFFD"] + Request.ServerVariables["URL\uFFFD"].Substring(0, Request.ServerVariables["URL\uFFFD"].LastIndexOf("/\uFFFD") + 1) + "temp/\uFFFD" + Session.SessionID + "_Image_\uFFFD" + embeddedObject.ContentName);
                }
            }
            iCc.Text      = System.String.Empty;
            iBcc.Text     = System.String.Empty;
            cSave.Checked = false;
            iSubject.Text = message.Subject.StartsWith("Re:\uFFFD") ? message.Subject : "Re:\uFFFD" + message.Subject;
            iTo.Text      = (message.Parsed.ReplyTo.Email != null) && message.Parsed.ReplyTo.Email != "\uFFFD" ? message.Parsed.ReplyTo.Email : message.From.Email;
            if ((message.Parsed.BodyHtml.Text != null) && (message.Parsed.BodyHtml.Text.Length > 0))
            {
                System.DateTime dateTime1 = message.Date;
                System.DateTime dateTime2 = message.Date;
                iBody.Text = "<br /><br /><hr />\uFFFD" + ((Language)Session["language\uFFFD"]).Words[30].ToString().Replace("$$SUBJECT$$\uFFFD", message.Subject).Replace("$$FROM$$\uFFFD", message.From.Link).Replace("$$DATE$$\uFFFD", dateTime1.Year > 1800 ? dateTime2.ToString("r\uFFFD", System.Globalization.DateTimeFormatInfo.CurrentInfo) : message.Parsed.DateString) + "<br /><hr />\uFFFD" + message.Parsed.BodyHtml.Text;
            }
            else if ((message.Parsed.BodyText.Text != null) && (message.Parsed.BodyText.Text.Length > 0))
            {
                System.DateTime dateTime3 = message.Date;
                System.DateTime dateTime4 = message.Date;
                iBody.Text = "<br /><br /><hr />\uFFFD" + ((Language)Session["language\uFFFD"]).Words[30].ToString().Replace("$$SUBJECT$$\uFFFD", message.Subject).Replace("$$FROM$$\uFFFD", message.From.Link).Replace("$$DATE$$\uFFFD", dateTime3.Year > 1800 ? dateTime4.ToString("r\uFFFD", System.Globalization.DateTimeFormatInfo.CurrentInfo) : message.Parsed.DateString) + "<br /><hr />\uFFFD" + message.Parsed.BodyText.Text;
            }
            pForm.Visible    = true;
            pConfirm.Visible = false;
        }
        catch (System.Exception e)
        {
            Page.RegisterStartupScript("ShowError\uFFFD", "<script>ShowErrorDialog('\uFFFD" + ((Language)Session["language\uFFFD"]).Words[78].ToString() + "','\uFFFD" + System.Text.RegularExpressions.Regex.Escape(e.Message + e.StackTrace).Replace("'\uFFFD", "\\'\uFFFD") + "');</script>\uFFFD");
        }
    }