예제 #1
0
        /// <summary>
        /// Print preview event handler.
        /// </summary>
        /// <param name="sender">The sender object.</param>
        /// <param name="e">The event arguments.</param>
        private void printPreviewToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string strText = string.Empty;//this.CreateMessage().ToMimeString();

            ActiveUp.Net.Mail.Message message = this.CreateSelectedMessage();
            if (message != null)
            {
                strText = message.ToMimeString();
            }
            mailMessageStringReader = new StringReader(strText);
            printPreviewDialog.ShowDialog();
        }
예제 #2
0
        /// <summary>
        /// Event for print message.
        /// </summary>
        /// <param name="sender">The sender object.</param>
        /// <param name="e">The event arguments.</param>
        public void toolStripButtonPrint_Click(object sender, EventArgs e)
        {
            string strText = string.Empty;//this.CreateMessage().ToMimeString();

            ActiveUp.Net.Mail.Message message = this.CreateSelectedMessage();
            if (message != null)
            {
                strText = message.ToMimeString();
            }
            mailMessageStringReader = new StringReader(strText);
            if (printDialog.ShowDialog() == DialogResult.OK)
            {
                this.printDocument.Print();
            }
        }
예제 #3
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");
     }
 }