예제 #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
    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");
        }
    }
예제 #3
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");
     }
 }
예제 #4
0
    public void MoveTOProcessedFolder(string fromMailBox, string toMailBox, string strMsgId)
    {
        //Copy and delete from fromMailBox folder to toMailBox folder
        FlagCollection flags;
        Mailbox mails = Client.SelectMailbox(fromMailBox);
        int[] ids = mails.Search("ALL");
        if (ids.Length > 0)
        {
            ActiveUp.Net.Mail.Message msg = null;
            for (var i = 0; i < ids.Length; i++)
            {
                msg = mails.Fetch.MessageObject(ids[i]);
                if( strMsgId.Contains ( Convert.ToString(ids[i]) ) )
                {
                    Client.Command("copy " + ids[i].ToString() + toMailBox );  //copy emails

                    flags = new FlagCollection(); //delete emails
                    flags.Add("Deleted");
                    mails.AddFlags(ids[i], flags);
                }
            }
        }
    }
예제 #5
0
파일: Program.cs 프로젝트: saxx/Imapsy
        private static void CopyItemsFromSourceToTarget(Options options, IEnumerable<Item> targetItems)
        {
            Console.WriteLine("Copying items from the source to the target ...");
            Connect(options.TargetHost, options.TargetPort, options.TargetUsername, options.TargetPassword, options.TargetFolder, options.TargetUseSsl,
                    (targetServer, targetMailbox) =>
                    {
                        Connect(options.SourceHost, options.SourcePort, options.SourceUsername, options.SourcePassword, options.SourceFolder, options.SourceUseSsl,
                                (sourceServer, sourceMailbox) =>
                                {
                                    var count = sourceMailbox.MessageCount;
                                    for (var i = options.StartCopyingAt; i <= count; i++)
                                    {
                                        var rawHeader = sourceMailbox.Fetch.Header(i);
                                        var parsedHeader = Parser.ParseHeader(rawHeader);

                                        Console.WriteLine("\t Downloaded {0}/{1}: '[{2}] {3}'", i, count, parsedHeader.Date, parsedHeader.Subject);

                                        if (targetItems.Any(x => x.Subject == parsedHeader.Subject && x.Date == parsedHeader.Date))
                                            Console.WriteLine("\t\t Skipped.");
                                        else
                                        {
                                            try
                                            {
                                                var rawMessage = sourceMailbox.Fetch.Message(i);

                                                var flags = new FlagCollection { new Flag("\\Seen") };
                                                targetMailbox.Append(rawMessage, flags, parsedHeader.Date.ToUniversalTime());
                                            }
                                            catch (Exception ex)
                                            {
                                                Console.WriteLine("\t\t Error: " + ex.Message);
                                            }
                                        }
                                    }
                                });
                    });
        }
예제 #6
0
        public void MYG_IMAP_READ_AND_MARK_ALWAYS_CONNECT()
        {
            int iCountNew = 0;
            string sNewMsgs = "";
            DateTime dtInizio = DateTime.Now;
            nIcon.Icon = MyGNotifier.Properties.Resources.MyGNotify_Checking;
            nIcon.Text = "STO CONTROLLANDO LA CASELLA DI POSTA...";

            Imap4Client imap = new Imap4Client();
            btnRECONNECT.Visible = false;

            # region CONNECT
            try
            {
                imap = new Imap4Client();
                imap.ConnectSsl(SERVER, PORTA);
                imap.Login(USER, PWD);
                bIMAP_ERROR = false;
            }
            catch (Exception errCONN)
            {
                nIcon.Icon = MyGNotifier.Properties.Resources.MyGNotify_Empty_Error;
                nIcon.Text = "ERRORE CONNESSIONE IMAP:\n" + errCONN.Message;

                bIMAP_ERROR = true;
                rtError.Text += DateTime.Now.ToString() + "-> ERRORE CONNESSIONE IMAP:\n" + errCONN.Message + "\n------------------\n";
                MGN_ERROR = DateTime.Now.ToString() + "-> ERRORE CONNESSIONE IMAP: " + errCONN.Message;
                if (MyGNotifier.Properties.Settings.Default.MAIN_AUTO_NOTIFY_ERROR)
                {
                    if (MyGNotifier.Properties.Settings.Default.MAIN_RAD_NOTIFIER)
                    {
                        RAD_NOTIFY_ERROR(MGN_ERROR);
                    }
                    else
                    {
                        NOTIFY_ERROR(MGN_ERROR);
                    }
                }
            }
            # endregion

            # region ELABORA MESSAGGI
            if (!bIMAP_ERROR)
            {
                try
                {
                    imap.Command("capability");
                    Mailbox inbox = imap.SelectMailbox("inbox");
                    int[] ids = inbox.Search("UNSEEN");
                    if (ids.Length > 0)
                    {
                        ActiveUp.Net.Mail.Message msg = null;

                        for (var i = 0; i < ids.Length; i++)
                        {
                            msg = inbox.Fetch.MessageObject(ids[i]);

                            string UNIQUE_ID = msg.Date.ToString() + msg.From.ToString();
                            if (!MSGS_ID.Contains(UNIQUE_ID))
                            {
                                iCountNew++;
                                MSGS_ID.Add(UNIQUE_ID);

                                rtLog.Text += DateTime.Now.ToString() + "\n";
                                rtLog.Text += "DATA: " + msg.Date + "\n";
                                rtLog.Text += "MITTENTE: " + msg.From + "\n";
                                rtLog.Text += "OGGETTO: " + msg.Subject + "\n";
                                rtLog.Text += "----------------------------\n";

                                sNewMsgs += "DATA: " + msg.Date + "\n";
                                sNewMsgs += "MITTENTE: " + msg.From + "\n";
                                sNewMsgs += "OGGETTO: " + msg.Subject + "\n";
                                sNewMsgs += "---------------------------\n";
                            }
                            //mark as unread
                            var flags = new FlagCollection();
                            flags.Add("Seen");
                            inbox.RemoveFlags(ids[i], flags);
                        }
                        if (iCountNew > 0)
                        {
                            iLastCOUNT = iCountNew;
                            MSGS_DETAILS = sNewMsgs;
                            nIcon.Icon = MyGNotifier.Properties.Resources.MyGNotify_Check;
                            nIcon.Text = iCountNew > 1 ? "SONO PRESENTI " + iCountNew + " NUOVI MESSAGGI" : "E' PRESENTE 1 NUOVO MESSAGGIO!";

                            bNewMsgICON = true;
                            NEW_MSGS = true;
                        }
                        else
                        {
                            nIcon.Icon = MyGNotifier.Properties.Resources.MyGNotify_Empty_Gray;
                            NEW_MSGS = false;
                        }
                    }
                    else
                    {
                        nIcon.Icon = MyGNotifier.Properties.Resources.MyGNotify_Empty_Gray;
                        NEW_MSGS = false;
                    }

                }
                catch (Exception err)
                {
                    nIcon.Icon = MyGNotifier.Properties.Resources.MyGNotify_Empty_Error;
                    rtError.Text += DateTime.Now.ToString() + "-> ERRORE CONNESSIONE IMAP:\n" + err.Message + "\n------------------\n"; ;
                    MGN_ERROR = DateTime.Now.ToString() + "-> ERRORE ELABORAZIONE IMAP: " + err.Message;
                    if (MyGNotifier.Properties.Settings.Default.MAIN_AUTO_NOTIFY_ERROR)
                    {
                        if (MyGNotifier.Properties.Settings.Default.MAIN_RAD_NOTIFIER)
                        {
                            RAD_NOTIFY_ERROR(MGN_ERROR);
                        }
                        else
                        {
                            NOTIFY_ERROR(MGN_ERROR);
                        }
                    }
                }
            }
            else
            {
                rtLog.Text += "\n---------------\n" + DateTime.Now.ToString() + "-> ERRORE CONNESSIONE IMAP!\n---------------\n";
            }
            # endregion

            # region DISCONNECT
            try
            {
                imap.Disconnect();
            }
            catch (Exception err)
            {
                nIcon.Icon = MyGNotifier.Properties.Resources.MyGNotify_Empty_Error;
                nIcon.Text = "ERRORE DISCONNESSIONE IMAP:\n" + err.Message;

                rtError.Text += DateTime.Now.ToString() + "-> ERRORE DISCONNESSIONE IMAP:\n" + err.Message + "\n------------------\n"; ;
                MGN_ERROR = DateTime.Now.ToString() + "-> ERRORE DISCONNESSIONE IMAP: " + err.Message;
                if (MyGNotifier.Properties.Settings.Default.MAIN_AUTO_NOTIFY_ERROR)
                {
                    if (MyGNotifier.Properties.Settings.Default.MAIN_RAD_NOTIFIER)
                    {
                        RAD_NOTIFY_ERROR(MGN_ERROR);
                    }
                    else
                    {
                        NOTIFY_ERROR(MGN_ERROR);
                    }
                }
            }
            # endregion

            if (bNewMsgICON) { nIcon.Icon = MyGNotifier.Properties.Resources.MyGNotify_Check; }
            else
            {
                if (!NEW_MSGS)
                {
                    nIcon.Text = "NESSUN NUOVO MESSAGGIO!";
                }
            }

            if (MyGNotifier.Properties.Settings.Default.MAIN_CHECK_MONITOR)
            {
                DateTime dtFine = DateTime.Now;
                TimeSpan ts = dtFine - dtInizio;
                rtLog.Text += DateTime.Now.ToString() + "-> FINE CONTROLLO CASELLA POSTA: DURATA CONTROLLO " + ts.Seconds.ToString() + " secondi.\n";
            }
        }
예제 #7
0
        public void MYG_IMAP_READ_AND_MARK(Imap4Client imap)
        {
            if (!bIMAP_ERROR)
            {
                nIcon.Icon = MyGNotifier.Properties.Resources.MyGNotify_Checking;
                try
                {
                    imap.Command("capability");

                    Mailbox inbox = imap.SelectMailbox("inbox");
                    int[] ids = inbox.Search("UNSEEN");
                    if (ids.Length > 0)
                    {
                        iCountIDS = 0;
                        for (var i = 0; i < ids.Length; i++)
                        {
                            if (!MSGS_ID.Contains(ids[i].ToString()))
                            {
                                iCountIDS++;
                                MSGS_ID.Add(ids[i].ToString());
                            }
                        }

                        if (iCountIDS > 0)
                        {
                            iLastCOUNT = iCountIDS;
                            MSGS_DETAILS = "";
                            nIcon.Icon = MyGNotifier.Properties.Resources.MyGNotify_Check;
                            bNewMsgICON = true;
                            NEW_MSGS = true;

                            //ActiveUp.Net.Mail.Message msg_first = inbox.Fetch.MessageObject(ids[0]);

                            //XElement xmail = new XElement("gmail",
                            //    new XAttribute("count", ids.Length.ToString()),
                            //    new XAttribute("modified", msg_first.Date.ToString())
                            //);

                            //string name = "", address = "", from = "";
                            //Regex reg_name = new Regex("\"[^\"]+");
                            //Regex reg_address = new Regex("<[^>]+");

                            ActiveUp.Net.Mail.Message msg = null;

                            for (var i = 0; i < ids.Length; i++)
                            {
                                msg = inbox.Fetch.MessageObject(ids[i]);

                                //from = msg.HeaderFields["from"];
                                //name = reg_name.Match(from).Value.Replace("\"", "");
                                //address = reg_address.Match(from).Value.Replace("<", "");

                                rtLog.Text += DateTime.Now.ToString() + "\n";
                                rtLog.Text += "DATA: " + msg.Date + "\n";
                                rtLog.Text += "MITTENTE: " + msg.From + "\n";
                                rtLog.Text += "OGGETTO: " + msg.Subject + "\n";
                                rtLog.Text += "----------------------------\n";

                                MSGS_DETAILS += "DATA: " + msg.Date + "\n";
                                MSGS_DETAILS += "MITTENTE: " + msg.From + "\n";
                                MSGS_DETAILS += "OGGETTO: " + msg.Subject + "\n";
                                MSGS_DETAILS += "---------------------------\n";

                                //xmail.Add(new XElement("entry",
                                //    new XAttribute("id", msg.MessageId),
                                //    new XAttribute("modified", msg.Date.ToString()),
                                //    new XAttribute("name", name),
                                //    new XAttribute("address", address),
                                //    new XElement("subject", msg.Subject),
                                //    new XElement("body-text", msg.BodyText.TextStripped),
                                //    new XElement("body-html", msg.BodyHtml.Text)
                                //));
                                //mark as unread
                                var flags = new FlagCollection();
                                flags.Add("Seen");
                                inbox.RemoveFlags(ids[i], flags);
                            }

                            //File.WriteAllText("gmail.xml", xmail.ToString());
                        }
                        else
                        {
                            NEW_MSGS = false;
                            nIcon.Icon = MyGNotifier.Properties.Resources.MyGNotify_Empty_Gray;
                        }
                    }
                    else
                    {
                        NEW_MSGS = false;
                        nIcon.Icon = MyGNotifier.Properties.Resources.MyGNotify_Empty_Gray;
                    }
                }
                catch (Exception err)
                {
                    nIcon.Icon = MyGNotifier.Properties.Resources.MyGNotify_Empty_Error;
                    rtError.Text += DateTime.Now.ToString() + "-> ERRORE CONNESSIONE IMAP:\n" + err.Message + "\n------------------\n"; ;
                    MGN_ERROR = DateTime.Now.ToString() + "-> ERRORE ELABORAZIONE IMAP: " + err.Message;
                    if (MGN_ERROR.ToLower().Contains("connessione interrotta"))
                    {
                        CONNECT_IMAP();
                    }
                    if (MyGNotifier.Properties.Settings.Default.MAIN_AUTO_NOTIFY_ERROR)
                    {
                        NOTIFY_ERROR(MGN_ERROR);
                    }
                }
            }
            else
            {
                rtLog.Text += "\n---------------\n" + DateTime.Now.ToString() + "-> ERRORE CONNESSIONE IMAP!\n---------------\n";
            }

            if (bNewMsgICON) { nIcon.Icon = MyGNotifier.Properties.Resources.MyGNotify_Check; }
        }
예제 #8
0
        private void _bSetFlag_Click(object sender, EventArgs e)
        {
            try
            {
                int index = int.Parse(_lvMessages.SelectedItems[0].Text);
                FlagCollection flags = new FlagCollection();
                flags.Add("Answered");
                inbox.SetFlags(1, flags);

                this.AddLogEntry(string.Format("Flat answered setted to the message with index {0}",index.ToString()));
            }

            catch (Exception ex)
            {
                this.AddLogEntry(string.Format("Failed: {0}", ex.Message));
            }
        }
예제 #9
0
        public FlagCollection UidFlags(int uid)
        {
            //this.ParentMailbox.SourceClient.SelectMailbox(this.ParentMailbox.Name);
            var flags = new FlagCollection();

            var response = ParentMailbox.SourceClient.Command("uid fetch " + uid.ToString(CultureInfo.InvariantCulture) + " flags",
                                                                   getFetchOptions());
            var flagsString =
                System.Text.RegularExpressions.Regex.Split(response.ToLower(), "flags ")[1].TrimStart('(').Split(')')[0];
            
            foreach (var str in flagsString.Split(' ').Where(str => str.StartsWith("\\")))
                flags.Add(str.Trim(new[] {' ', '\\', ')', '('}));

            return flags;
        }
예제 #10
0
 /// <summary>
 /// Fetches the message's flags.
 /// </summary>
 /// <param name="messageOrdinal">The ordinal position of the message info to be fetched.</param>
 /// <returns>A collection of flags.</returns>
     /// <example>
 /// <code>
 /// C#
 /// 
 /// Imap4Client imap = new Imap4Client();
 /// imap.Connect("mail.myhost.com");
 /// imap.Login("jdoe1234","tanstaaf");
 /// Mailbox inbox = imap.SelectMailbox("inbox");
 /// FlagCollection flags = inbox.Fetch.Flags(1);
 /// inbox.Close();
 /// imap.Disconnect();
 /// 
 /// VB.NET
 /// 
 /// Dim imap As New Imap4Client
 /// imap.Connect("mail.myhost.com")
 /// imap.Login("jdoe1234","tanstaaf")
 /// Dim inbox As Mailbox = imap.SelectMailbox("inbox")
 /// Dim flags As FlagCollection = inbox.Fetch.Flags(1);
 /// inbox.Close()
 /// imap.Disconnect()
 /// 
 /// JScript.NET
 /// 
 /// var imap:Imap4Client = new Imap4Client();
 /// imap.Connect("mail.myhost.com");
 /// imap.Login("jdoe1234","tanstaaf");
 /// var inbox:Mailbox = imap.SelectMailbox("inbox");
 /// var flags:FlagCollection = inbox.Fetch.Flags(1);
 /// inbox.Close();
 /// imap.Disconnect();
 /// </code>
 /// </example>
 public FlagCollection Flags(int messageOrdinal)
 {
     this.ParentMailbox.SourceClient.SelectMailbox(this.ParentMailbox.Name);
     ActiveUp.Net.Mail.FlagCollection flags = new ActiveUp.Net.Mail.FlagCollection();
     string response = this.ParentMailbox.SourceClient.Command("fetch " + messageOrdinal.ToString() + " flags", getFetchOptions());
     string flags_string = System.Text.RegularExpressions.Regex.Split(response.ToLower(),"flags ")[1].TrimStart('(').Split(')')[0];
     foreach(string str in flags_string.Split(' ')) if(str.StartsWith("\\")) flags.Add(str.Trim(new char[] {' ','\\',')','('}));
     return flags;
 }
예제 #11
0
 public void UidDeleteMessage(int uid, bool expunge)
 {    
     ActiveUp.Net.Mail.FlagCollection flags = new ActiveUp.Net.Mail.FlagCollection();
     flags.Add("Deleted");
     this.UidAddFlagsSilent(uid,flags);
     if(expunge) this.SourceClient.Expunge();
 }
예제 #12
0
 /// <summary>
 /// Empties the mailbox.
 /// </summary>
 /// <param name="expunge">If true, all messages are permanently removed. Otherwise they are all marked with the Deleted flag.</param>
 /// <example>
 /// <code>
 /// C#
 ///  
 /// Imap4Client imap = new Imap4Client();
 /// imap.Connect("mail.myhost.com");
 /// imap.Login("jdoe1234","tanstaaf");
 /// Mailbox inbox = imap.SelectInbox("inbox");
 /// inbox.Empty(true);
 /// //Messages from inbox are permanently removed.
 /// imap.Disconnect();
 /// 
 /// VB.NET
 ///  
 /// Dim imap As New Imap4Client
 /// imap.Connect("mail.myhost.com")
 /// imap.Login("jdoe1234","tanstaaf")
 /// Dim inbox As Mailbox = imap.SelectInbox("inbox")
 /// inbox.Empty(True)
 /// 'Messages from inbox are permanently removed.
 /// imap.Disconnect()
 /// 
 /// JScript.NET
 ///  
 /// var imap:Imap4Client imap = new Imap4Client();
 /// imap.Connect("mail.myhost.com");
 /// imap.Login("jdoe1234","tanstaaf");
 /// var inbox:Mailbox = imap.SelectInbox("inbox");
 /// inbox.Empty(true);
 /// //Messages from inbox are permanently removed.
 /// imap.Disconnect();
 /// </code>
 /// </example>
 public void Empty(bool expunge)
 {
     
     ActiveUp.Net.Mail.FlagCollection flags = new ActiveUp.Net.Mail.FlagCollection();
     flags.Add("Deleted");
     for(int i=1;i<=this.MessageCount;i++) this.AddFlagsSilent(i,flags);
     if(expunge) this.SourceClient.Expunge();
 }
예제 #13
0
        public void MarkAsUnread(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);
                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"));
                for (i = 1; i < (dMailbox.Controls.Count - 1); i++)
                {
                    if (((System.Web.UI.WebControls.CheckBox)dMailbox.Controls[i].FindControl("select\uFFFD")).Checked)
                    {
                        if (mailbox.Fetch.Flags(dMailbox.Controls.Count - 1 - i).Merged.IndexOf("\\seen\uFFFD") != -1)
                        {
                            mailbox.RemoveFlagsSilent(dMailbox.Controls.Count - 1 - i, flagCollection);
                            envelopeCollection[envelopeCollection.Count - (dMailbox.Controls.Count - 1 - i)].Read = false;
                            continue;
                        }
                        mailbox.AddFlagsSilent(dMailbox.Controls.Count - 1 - i, flagCollection);
                        envelopeCollection[envelopeCollection.Count - (dMailbox.Controls.Count - 1 - i)].Read = true;
                    }
                }
                envelopeCollection.Save(Page.Server.MapPath(Application["writedirectory\uFFFD"].ToString() + Session["login\uFFFD"] + "_\uFFFD" + Server.UrlEncode(mailbox.Name) + ".xml\uFFFD"));
                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");
            }
        }
예제 #14
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");
     }
 }
예제 #15
0
        private void StoreMessageToImapSentFolder(MailBox mbox, Message mimeMessage)
        {
            if (mimeMessage == null || !mbox.Imap || NoImapSendSyncServers.Contains(mbox.Server))
                return;
            
            var imap = MailClientBuilder.Imap();
            try
            {
                imap.AuthenticateImap(mbox, log);

                // reverse folders and order them to download tagged incoming messages first
                // gmail returns tagged letters in mailboxes & duplicate them in inbox
                // to retrieve tags - first we need to download files from "sub" mailboxes
                var sentFolder =
                    imap.GetImapMailboxes(mbox.Server, MailQueueItemSettings.SpecialDomainFolders,
                                          MailQueueItemSettings.SkipImapFlags, MailQueueItemSettings.ImapFlags)
                        .FirstOrDefault(m => m.folder_id == MailFolder.Ids.sent);

                if (sentFolder == null)
                    throw new InvalidDataException(String.Format("Cannot find Sent folder over Imap. MailboxId={0}",
                                                                 mbox.MailBoxId));
                
                var mailbox = imap.SelectMailbox(sentFolder.name);

                var flags = new FlagCollection {"Seen"};

                var response = mailbox.Append(mimeMessage, flags);

                log.Info("StoreMessageToImapSentFolder() in MailboxId={0} successed! Returned: '{0}'", response);
            }
            catch (Exception ex)
            {
                log.Error("StoreMessageToSentFolder() in MailboxId={0} failed with exception:\r\n{1}",
                           mbox.MailBoxId, ex.ToString());
            }
            finally
            {
                try
                {
                    if (imap.IsConnected)
                    {
                        imap.Disconnect();
                    }
                }
                catch
                {
                }
            }
        }
예제 #16
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");
     }
 }