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");
     }
 }
Example #2
0
        public ActionResult DetailMail(long id)
        {
            Email Email = new Email();
            Imap  imp   = new Imap();

            // Connect to the server, login and select inbox.
            imp.Connect("IMAP.gmail.com");
            imp.Login("*****@*****.**", "tantan1193");
            imp.SelectFolder("INBOX");
            EnvelopeCollection envelopes = imp.DownloadEnvelopes(Imap.AllMessages, false);

            envelopes.Reverse();
            foreach (Envelope env in envelopes)
            {
                if (id == env.Uid)
                {
                    Email.subject = env.Subject;
                    Email.name    = env.From;
                    Email.Date    = env.Date;

                    break;
                }
            }
            // Disconnect from the server.
            imp.Disconnect();
            return(View(Email));
        }
 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");
     }
 }
Example #4
0
        public ActionResult Index(FormCollection form, string typeName)
        {
            var inputCheck = form.GetValues("inputCheck");

            ViewBag.Mess = EvenList(inputCheck, typeName);
            List <Email> Email = new List <Email>();
            Imap         imp   = new Imap();

            // Connect to the server, login and select inbox.
            imp.Connect("IMAP.gmail.com");
            imp.Login("*****@*****.**", "tantan1193");
            imp.SelectFolder("INBOX");
            // Get envelopes for the specified messages.
            EnvelopeCollection envelopes = imp.DownloadEnvelopes(Imap.AllMessages, false);

            // Make newer messages be displayed first.
            envelopes.Reverse();

            foreach (Envelope env in envelopes)
            {
                Email.Add(new Email()
                {
                    Uid     = env.Uid,
                    subject = env.Subject,
                    name    = env.From,
                    Date    = env.Date
                });
            }
            // Disconnect from the server.
            imp.Disconnect();
            return(View(Email.ToList()));
        }
Example #5
0
        public int DeleteConfirmed(string[] inputCheck)
        {
            Email Email = new Email();
            Imap  imp   = new Imap();

            // Connect to the server, login and select inbox.
            imp.Connect("IMAP.gmail.com");
            imp.Login("*****@*****.**", "tantan1193");
            imp.SelectFolder("INBOX");
            EnvelopeCollection envelopes = imp.DownloadEnvelopes(Imap.AllMessages, false);

            envelopes.Reverse();
            int rowFinish = 0;

            if (inputCheck == null)
            {
                return(rowFinish);
            }
            foreach (var s in inputCheck)
            {
                long idMenu = Convert.ToInt32(DefineFuntion.Decrypt(s));
                foreach (Envelope env in envelopes)
                {
                    if (idMenu == env.Uid)
                    {
                        imp.DeleteMessages(env.Uid.ToString(), true);
                        break;
                    }
                }
            }

            // Disconnect from the server.
            imp.Disconnect();
            return(rowFinish);
        }
Example #6
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");
        }
    }
        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");
            }
        }
Example #8
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");
     }
 }
Example #9
0
        // GET: MailBox
        public ActionResult Index( )

        {
            List <Email> Email = new List <Email>();
            Imap         imp   = new Imap();

            //imp.DeleteMessages(, true);
            // Connect to the server, login and select inbox.
            imp.Connect("IMAP.gmail.com");
            imp.Login("*****@*****.**", "tantan1193");
            imp.SelectFolder("INBOX");
            string range;

            // Does the inbox contain at least 10 mails?
            if (imp.MessageCount >= 10)
            {
                // We'll get last 10 mails.
                range = (imp.MessageCount - 9).ToString() + ":" + "*";
            }
            else
            {
                // We'll get all mails.
                range = Imap.AllMessages;
            }

            // Get envelopes for the specified messages.
            EnvelopeCollection envelopes = imp.DownloadEnvelopes(range, false);

            // Make newer messages be displayed first.
            envelopes.Reverse();

            foreach (Envelope env in envelopes)
            {
                Email.Add(new Email()
                {
                    Uid     = env.Uid,
                    subject = env.Subject,
                    name    = env.From,
                    Date    = env.Date
                });
            }
            // Disconnect from the server.
            imp.Disconnect();
            return(View(Email.ToList()));
        }
Example #10
0
    public void Reply(object sender, System.Web.UI.WebControls.CommandEventArgs e)
    {
        int i4;

        //BoundComposer.SetLanguage(((Language)Session["language\uFFFD"]).Code);
        int i1 = 0;

        for (int i2 = 1; i2 < (dMailbox.Controls.Count - 1); i2++)
        {
            if (((System.Web.UI.WebControls.CheckBox)dMailbox.Controls[i2].FindControl("select\uFFFD")).Checked)
            {
                i1++;
            }
        }
        if (i1 == 1)
        {
            for (int i3 = 1; i3 < (dMailbox.Controls.Count - 1); i3++)
            {
                if (((System.Web.UI.WebControls.CheckBox)dMailbox.Controls[i3].FindControl("select\uFFFD")).Checked)
                {
                    char[] chArr1 = new char[] { '|' };
                    //BoundComposer.LoadReply(Application["server\uFFFD"].ToString(), Page.User.Identity.Name.Split(chArr1)[0], MailboxName, dMailbox.Controls.Count - 1 - i3, true);
                }
            }
        }
        else
        {
            EnvelopeCollection envelopeCollection = EnvelopeCollection.Load(Page.Server.MapPath(Application["writedirectory\uFFFD"].ToString() + Session["login\uFFFD"] + "_\uFFFD" + Server.UrlEncode(MailboxName) + ".xml\uFFFD"));
            string             s = System.String.Empty;
            for (i4 = 1; i4 < (dMailbox.Controls.Count - 1); i4++)
            {
                if (((System.Web.UI.WebControls.CheckBox)dMailbox.Controls[i4].FindControl("select\uFFFD")).Checked)
                {
                    s = s + envelopeCollection[envelopeCollection.Count - (dMailbox.Controls.Count - 1 - i4)].From.Email + ",\uFFFD";
                }
            }
            char[] chArr2 = new char[] { ',' };
            //BoundComposer.LoadParams(s.TrimEnd(chArr2), System.String.Empty, System.String.Empty, true);
            envelopeCollection.Save(Page.Server.MapPath(Application["writedirectory\uFFFD"].ToString() + Session["login\uFFFD"] + "_\uFFFD" + Server.UrlEncode(MailboxName) + ".xml\uFFFD"));
        }
    }
    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");
        }
    }
        public void LoadMailbox(EnvelopeCollection envelopes, bool showThisHideBounds)
        {
            string[] sArr1;

            try
            {
                if (showThisHideBounds)
                    ShowThisHideBounds();
                Visible = true;
                EnableViewState = true;
                System.Data.DataTable dataTable = new System.Data.DataTable();
                dataTable.Columns.Add("Date\uFFFD");
                dataTable.Columns.Add("Size\uFFFD");
                foreach (Envelope envelope in envelopes)
                {
                    if (envelope.Read)
                    {
                        string[] sArr2 = new string[2];
                        System.DateTime dateTime1 = envelope.Date;
                        System.DateTime dateTime2 = envelope.Date;
                        sArr2[0] = dateTime1.Year > 1800 ? dateTime2.ToString("dddd dd MMMM yyyy HH:mm\uFFFD") : envelope.DateString;
                        sArr2[1] = GetSize(envelope.Size);
                        sArr1 = sArr2;
                    }
                    else
                    {
                        string[] sArr3 = new string[2];
                        System.DateTime dateTime3 = envelope.Date;
                        System.DateTime dateTime4 = envelope.Date;
                        sArr3[0] = "<b>\uFFFD" + (dateTime3.Year > 1800 ? dateTime4.ToString("dddd dd MMMM yyyy HH:mm\uFFFD") : envelope.DateString) + "</b>\uFFFD";
                        sArr3[1] = "<b>\uFFFD" + GetSize(envelope.Size) + "</b>\uFFFD";
                        sArr1 = sArr3;
                    }
                    dataTable.Rows.Add(sArr1);
                }
                dMailbox.DataSource = dataTable;
                dMailbox.DataBind();
                for (int i1 = 1; i1 < (dMailbox.Controls.Count - 1); i1++)
                {
                    int i3 = envelopes[i1 - 1].Id;
                    ((System.Web.UI.WebControls.LinkButton)dMailbox.Controls[i1].FindControl("lMSubject\uFFFD")).CommandArgument = envelopes[i1 - 1].Mailbox + "|\uFFFD" + i3.ToString();
                    if (envelopes[i1 - 1].Read)
                        ((System.Web.UI.WebControls.LinkButton)dMailbox.Controls[i1].FindControl("lMSubject\uFFFD")).Text = Server.HtmlEncode((envelopes[i1 - 1].Subject != null) && (envelopes[i1 - 1].Subject.Length > 50) ? envelopes[i1 - 1].Subject.Substring(0, 47) + "...\uFFFD" : (envelopes[i1 - 1].Subject != null) && (envelopes[i1 - 1].Subject.Length > 0) ? envelopes[i1 - 1].Subject : "(\uFFFD" + ((Language)Session["language\uFFFD"]).Words[71].ToString() + ")\uFFFD");
                    else
                        ((System.Web.UI.WebControls.LinkButton)dMailbox.Controls[i1].FindControl("lMSubject\uFFFD")).Text = "<b>\uFFFD" + Server.HtmlEncode((envelopes[i1 - 1].Subject != null) && (envelopes[i1 - 1].Subject.Length > 50) ? envelopes[i1 - 1].Subject.Substring(0, 47) + "...\uFFFD" : (envelopes[i1 - 1].Subject != null) && (envelopes[i1 - 1].Subject.Length > 0) ? envelopes[i1 - 1].Subject : "(\uFFFD" + ((Language)Session["language\uFFFD"]).Words[71].ToString() + ")\uFFFD") + "</b>\uFFFD";
                    ((System.Web.UI.WebControls.LinkButton)dMailbox.Controls[i1].FindControl("lMFrom\uFFFD")).CommandArgument = envelopes[i1 - 1].From.Email;
                    if (envelopes[i1 - 1].Read)
                        ((System.Web.UI.WebControls.LinkButton)dMailbox.Controls[i1].FindControl("lMFrom\uFFFD")).Text = Server.HtmlEncode((envelopes[i1 - 1].From.Name != null) && (envelopes[i1 - 1].From.Name.Length > 50) ? envelopes[i1 - 1].From.Name.Substring(0, 47) + "...\uFFFD" : (envelopes[i1 - 1].From.Name != null) && (envelopes[i1 - 1].From.Name.Length > 0) ? envelopes[i1 - 1].From.Name : envelopes[i1 - 1].From.Email);
                    else
                        ((System.Web.UI.WebControls.LinkButton)dMailbox.Controls[i1].FindControl("lMFrom\uFFFD")).Text = "<b>\uFFFD" + Server.HtmlEncode((envelopes[i1 - 1].From.Name != null) && (envelopes[i1 - 1].From.Name.Length > 50) ? envelopes[i1 - 1].From.Name.Substring(0, 47) + "...\uFFFD" : (envelopes[i1 - 1].From.Name != null) && (envelopes[i1 - 1].From.Name.Length > 0) ? envelopes[i1 - 1].From.Name : envelopes[i1 - 1].From.Email) + "</b>\uFFFD";
                    if (envelopes[i1 - 1].Answered)
                        ((System.Web.UI.WebControls.Image)dMailbox.Controls[i1].FindControl("fIcon\uFFFD")).ImageUrl = "icons/replied.gif\uFFFD";
                    else if (envelopes[i1 - 1].Forwarded)
                        ((System.Web.UI.WebControls.Image)dMailbox.Controls[i1].FindControl("fIcon\uFFFD")).ImageUrl = "icons/forwarded.gif\uFFFD";
                    else if (envelopes[i1 - 1].Read)
                        ((System.Web.UI.WebControls.Image)dMailbox.Controls[i1].FindControl("fIcon\uFFFD")).ImageUrl = "icons/read.gif\uFFFD";
                    else
                        ((System.Web.UI.WebControls.Image)dMailbox.Controls[i1].FindControl("fIcon\uFFFD")).ImageUrl = "icons/unread.gif\uFFFD";
                    if (envelopes[i1 - 1].Marked)
                        ((System.Web.UI.WebControls.Image)dMailbox.Controls[i1].FindControl("fMark\uFFFD")).ImageUrl = "icons/marked.gif\uFFFD";
                    else
                        ((System.Web.UI.WebControls.Image)dMailbox.Controls[i1].FindControl("fMark\uFFFD")).ImageUrl = "icons/unmarked.gif\uFFFD";
                }
                for (int i2 = 0; i2 < dMailbox.Controls[0].Controls.Count; i2++)
                {
                    if ((dMailbox.Controls[0].Controls[i2].GetType() == typeof(System.Web.UI.WebControls.Label)) && dMailbox.Controls[0].Controls[i2].ID.StartsWith("lt\uFFFD"))
                        ((System.Web.UI.WebControls.Label)dMailbox.Controls[0].Controls[i2]).Text = ((Language)Session["language\uFFFD"]).Words[System.Convert.ToInt32(dMailbox.Controls[0].Controls[i2].ID.Replace("lt\uFFFD", "\uFFFD"))].ToString();
                }
                lFolder.Text = MailboxName;
            }
            catch (System.Exception e)
            {
                Page.RegisterStartupScript("ShowError\uFFFD", "<script>ShowErrorDialog('\uFFFD" + ((Language)Session["language\uFFFD"]).Words[92].ToString() + "','\uFFFD" + System.Text.RegularExpressions.Regex.Escape(e.Message + e.StackTrace).Replace("'\uFFFD", "\\'\uFFFD") + "');</script>\uFFFD");
            }
        }
 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");
     }
 }
Example #14
0
    public void LoadMailbox(EnvelopeCollection envelopes, bool showThisHideBounds)
    {
        string[] sArr1;

        try
        {
            if (showThisHideBounds)
            {
                ShowThisHideBounds();
            }
            Visible         = true;
            EnableViewState = true;
            System.Data.DataTable dataTable = new System.Data.DataTable();
            dataTable.Columns.Add("Date\uFFFD");
            dataTable.Columns.Add("Size\uFFFD");
            foreach (Envelope envelope in envelopes)
            {
                if (envelope.Read)
                {
                    string[]        sArr2     = new string[2];
                    System.DateTime dateTime1 = envelope.Date;
                    System.DateTime dateTime2 = envelope.Date;
                    sArr2[0] = dateTime1.Year > 1800 ? dateTime2.ToString("dddd dd MMMM yyyy HH:mm\uFFFD") : envelope.DateString;
                    sArr2[1] = GetSize(envelope.Size);
                    sArr1    = sArr2;
                }
                else
                {
                    string[]        sArr3     = new string[2];
                    System.DateTime dateTime3 = envelope.Date;
                    System.DateTime dateTime4 = envelope.Date;
                    sArr3[0] = "<b>\uFFFD" + (dateTime3.Year > 1800 ? dateTime4.ToString("dddd dd MMMM yyyy HH:mm\uFFFD") : envelope.DateString) + "</b>\uFFFD";
                    sArr3[1] = "<b>\uFFFD" + GetSize(envelope.Size) + "</b>\uFFFD";
                    sArr1    = sArr3;
                }
                dataTable.Rows.Add(sArr1);
            }
            dMailbox.DataSource = dataTable;
            dMailbox.DataBind();
            for (int i1 = 1; i1 < (dMailbox.Controls.Count - 1); i1++)
            {
                int i3 = envelopes[i1 - 1].Id;
                ((System.Web.UI.WebControls.LinkButton)dMailbox.Controls[i1].FindControl("lMSubject\uFFFD")).CommandArgument = envelopes[i1 - 1].Mailbox + "|\uFFFD" + i3.ToString();
                if (envelopes[i1 - 1].Read)
                {
                    ((System.Web.UI.WebControls.LinkButton)dMailbox.Controls[i1].FindControl("lMSubject\uFFFD")).Text = Server.HtmlEncode((envelopes[i1 - 1].Subject != null) && (envelopes[i1 - 1].Subject.Length > 50) ? envelopes[i1 - 1].Subject.Substring(0, 47) + "...\uFFFD" : (envelopes[i1 - 1].Subject != null) && (envelopes[i1 - 1].Subject.Length > 0) ? envelopes[i1 - 1].Subject : "(\uFFFD" + ((Language)Session["language\uFFFD"]).Words[71].ToString() + ")\uFFFD");
                }
                else
                {
                    ((System.Web.UI.WebControls.LinkButton)dMailbox.Controls[i1].FindControl("lMSubject\uFFFD")).Text = "<b>\uFFFD" + Server.HtmlEncode((envelopes[i1 - 1].Subject != null) && (envelopes[i1 - 1].Subject.Length > 50) ? envelopes[i1 - 1].Subject.Substring(0, 47) + "...\uFFFD" : (envelopes[i1 - 1].Subject != null) && (envelopes[i1 - 1].Subject.Length > 0) ? envelopes[i1 - 1].Subject : "(\uFFFD" + ((Language)Session["language\uFFFD"]).Words[71].ToString() + ")\uFFFD") + "</b>\uFFFD";
                }
                ((System.Web.UI.WebControls.LinkButton)dMailbox.Controls[i1].FindControl("lMFrom\uFFFD")).CommandArgument = envelopes[i1 - 1].From.Email;
                if (envelopes[i1 - 1].Read)
                {
                    ((System.Web.UI.WebControls.LinkButton)dMailbox.Controls[i1].FindControl("lMFrom\uFFFD")).Text = Server.HtmlEncode((envelopes[i1 - 1].From.Name != null) && (envelopes[i1 - 1].From.Name.Length > 50) ? envelopes[i1 - 1].From.Name.Substring(0, 47) + "...\uFFFD" : (envelopes[i1 - 1].From.Name != null) && (envelopes[i1 - 1].From.Name.Length > 0) ? envelopes[i1 - 1].From.Name : envelopes[i1 - 1].From.Email);
                }
                else
                {
                    ((System.Web.UI.WebControls.LinkButton)dMailbox.Controls[i1].FindControl("lMFrom\uFFFD")).Text = "<b>\uFFFD" + Server.HtmlEncode((envelopes[i1 - 1].From.Name != null) && (envelopes[i1 - 1].From.Name.Length > 50) ? envelopes[i1 - 1].From.Name.Substring(0, 47) + "...\uFFFD" : (envelopes[i1 - 1].From.Name != null) && (envelopes[i1 - 1].From.Name.Length > 0) ? envelopes[i1 - 1].From.Name : envelopes[i1 - 1].From.Email) + "</b>\uFFFD";
                }
                if (envelopes[i1 - 1].Answered)
                {
                    ((System.Web.UI.WebControls.Image)dMailbox.Controls[i1].FindControl("fIcon\uFFFD")).ImageUrl = "icons/replied.gif\uFFFD";
                }
                else if (envelopes[i1 - 1].Forwarded)
                {
                    ((System.Web.UI.WebControls.Image)dMailbox.Controls[i1].FindControl("fIcon\uFFFD")).ImageUrl = "icons/forwarded.gif\uFFFD";
                }
                else if (envelopes[i1 - 1].Read)
                {
                    ((System.Web.UI.WebControls.Image)dMailbox.Controls[i1].FindControl("fIcon\uFFFD")).ImageUrl = "icons/read.gif\uFFFD";
                }
                else
                {
                    ((System.Web.UI.WebControls.Image)dMailbox.Controls[i1].FindControl("fIcon\uFFFD")).ImageUrl = "icons/unread.gif\uFFFD";
                }
                if (envelopes[i1 - 1].Marked)
                {
                    ((System.Web.UI.WebControls.Image)dMailbox.Controls[i1].FindControl("fMark\uFFFD")).ImageUrl = "icons/marked.gif\uFFFD";
                }
                else
                {
                    ((System.Web.UI.WebControls.Image)dMailbox.Controls[i1].FindControl("fMark\uFFFD")).ImageUrl = "icons/unmarked.gif\uFFFD";
                }
            }
            for (int i2 = 0; i2 < dMailbox.Controls[0].Controls.Count; i2++)
            {
                if ((dMailbox.Controls[0].Controls[i2].GetType() == typeof(System.Web.UI.WebControls.Label)) && dMailbox.Controls[0].Controls[i2].ID.StartsWith("lt\uFFFD"))
                {
                    ((System.Web.UI.WebControls.Label)dMailbox.Controls[0].Controls[i2]).Text = ((Language)Session["language\uFFFD"]).Words[System.Convert.ToInt32(dMailbox.Controls[0].Controls[i2].ID.Replace("lt\uFFFD", "\uFFFD"))].ToString();
                }
            }
            lFolder.Text = MailboxName;
        }
        catch (System.Exception e)
        {
            Page.RegisterStartupScript("ShowError\uFFFD", "<script>ShowErrorDialog('\uFFFD" + ((Language)Session["language\uFFFD"]).Words[92].ToString() + "','\uFFFD" + System.Text.RegularExpressions.Regex.Escape(e.Message + e.StackTrace).Replace("'\uFFFD", "\\'\uFFFD") + "');</script>\uFFFD");
        }
    }