public void Insert(ActiveUp.Net.Mail.Message entity) { using (MailMessageDaoSQLDb dao = new MailMessageDaoSQLDb()) { dao.Insert(entity); } }
private void Page_Load(object sender, System.EventArgs e) { ActiveUp.Net.Mail.MimePartCollection attachmentCollection = new ActiveUp.Net.Mail.MimePartCollection(); ActiveUp.Net.Mail.Mailbox mailbox = ((ActiveUp.Net.Mail.Imap4Client)Session["imapobject\uFFFD"]).SelectMailbox(Request.QueryString["b\uFFFD"]); ActiveUp.Net.Mail.Message message = mailbox.Fetch.MessageObject(System.Convert.ToInt32(Request.QueryString["m\uFFFD"])); attachmentCollection = message.Attachments; if (Request.QueryString["f\uFFFD"].EndsWith(".eml\uFFFD")) { foreach (ActiveUp.Net.Mail.MimePart attachment1 in attachmentCollection) { if (attachment1.ContentType.MimeType == "message/rfc822\uFFFD" && ActiveUp.Net.Mail.Parser.ParseHeader(attachment1.BinaryContent).Subject == Request.QueryString["f\uFFFD"].Substring(0, Request.QueryString["f\uFFFD"].Length - 4)) { Response.AddHeader("Content-Disposition\uFFFD", "attachment; filename=\uFFFD" + Request.QueryString["f\uFFFD"]); Response.ContentType = attachment1.ContentType.MimeType; Response.BinaryWrite(attachment1.BinaryContent); } } } foreach (ActiveUp.Net.Mail.MimePart attachment2 in attachmentCollection) { if (attachment2.Filename == Server.HtmlDecode(Request.QueryString["f\uFFFD"]) || attachment2.ContentName == Server.HtmlDecode(Request.QueryString["f\uFFFD"])) { string s = attachment2.Filename == Server.HtmlDecode(Request.QueryString["f\uFFFD"]) ? attachment2.Filename : attachment2.ContentName; Response.AddHeader("Content-Disposition\uFFFD", "attachment; filename=\uFFFD" + s); Response.ContentType = attachment2.ContentType.MimeType; Response.BinaryWrite(attachment2.BinaryContent); } } }
public void Update(MailUser user, ActiveUp.Net.Mail.Message entity) { using (MailMessageDaoSQLDb dao = new MailMessageDaoSQLDb()) { dao.Update(user, entity); } }
public void OnRetrieveNewMessage(MailQueueItem account, ActiveUp.Net.Mail.Message message, int folder_id, string uidl, string md5_hash, bool has_parse_error, bool unread, int[] tags_ids) { MailMessageItem message_item; if (_mailBoxManager.MailReceive(account.Account, message, folder_id, uidl, md5_hash, has_parse_error, unread, tags_ids, out message_item) < 1) { throw new Exception("MailReceive() returned id < 1;"); } if (message_item == null) { return; } foreach (var handler in _messageHandlers) { try { handler.HandleRetrievedMessage(account.Account, message, message_item, folder_id, uidl, md5_hash, unread, tags_ids); } catch (Exception ex) { _log.Error(ex, "MailItemManager::OnRetrieveNewMessage"); } } }
/// <summary> /// Method for create the selected as a ActiveUp.Net.Mail.Message. /// </summary> /// <returns>The ActiveUp.Net.Mail.Message object.</returns> private ActiveUp.Net.Mail.Message CreateSelectedMessage() { ActiveUp.Net.Mail.Message message = new ActiveUp.Net.Mail.Message(); MailMessage mailMessage = this.rightSpine1.GetSelectedMessage(); if (mailMessage != null) { Facade facade = Facade.GetInstance(); ActiveUp.MailSystem.DesktopClient.AccountSettings.AccountInfo accInfo = facade.GetDefaultAccountInfo(); if (accInfo != null) { message.From.Email = accInfo.EmailAddress; } string separator = ","; string[] recipients = mailMessage.To.Split(separator.ToCharArray()); foreach (string r in recipients) { // We assign the recipient email message.To.Add(r); } // We assign the subject message.Subject = mailMessage.Subject; // We assign the body text message.BodyText.Text = this.rightSpine1.GetSelectedMessageBody(); } return(message); }
public void Insert(ActiveUp.Net.Mail.DeltaExt.MailUser us, ActiveUp.Net.Mail.Message mex) { using (MailMessageDaoSQLDb dao = new MailMessageDaoSQLDb()) { dao.Insert(us, mex); } }
/// <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(); }
public void OnRetrieveNewMessage(MailQueueItem account, ActiveUp.Net.Mail.Message message, int folder_id, string uidl, string md5_hash, bool unread, int[] tags_ids) { if (mailBoxManager.MailReceive(account.Account, message, folder_id, uidl, md5_hash, unread, tags_ids) < 1) { throw new Exception("MailReceive() returned id < 1;"); } }
/// <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(); } }
/// <summary> /// Event for save message. /// </summary> /// <param name="sender">The sender object.</param> /// <param name="e">The event arguments.</param> private void saveAsToolStripMenuItem_Click(object sender, EventArgs e) { string currentDir = Directory.GetCurrentDirectory(); SaveFileDialog saveDialog = new SaveFileDialog(); saveDialog.Filter = "ActiveUp Email Files |*.eml"; DialogResult dr = saveDialog.ShowDialog(); if (dr == DialogResult.OK) { ActiveUp.Net.Mail.Message message = this.CreateSelectedMessage(); if (message != null) { message.StoreToFile(saveDialog.FileName); } } Directory.SetCurrentDirectory(currentDir); }
/// <summary> /// Replace all specified fields of the message body with the specified replacement. /// </summary> /// <param name="message">The message.</param> /// <param name="field">The field to search for.</param> /// <param name="replacement">The replacement.</param> public Message ReplaceField(ActiveUp.Net.Mail.Message message, string field, string replacement) { message.Bcc = ReplaceInAddresses(message.Bcc, field, replacement); message.Cc = ReplaceInAddresses(message.Cc, field, replacement); if (message.From != null) { message.From.Email = message.From.Email.Replace("$" + field + "$", replacement); message.From.Name = message.From.Name.Replace("$" + field + "$", replacement); } if (message.Subject != null) { message.Subject = message.Subject.Replace("$" + field + "$", replacement); } message.To = ReplaceInAddresses(message.To, field, replacement); message.BodyText.Text = ReplaceField(message.BodyText.Text, field, replacement); message.BodyHtml.Text = ReplaceField(message.BodyHtml.Text, field, replacement); foreach (Region region in this.Regions) { region.URL = ReplaceField(region.URL, field, replacement); } return(message); }
internal static MAIL_INBOX MapToMailInBox(MailUser u, ActiveUp.Net.Mail.Message m) { MAIL_INBOX inbox = new MAIL_INBOX(); inbox.MAIL_FROM = m.From.ToString(); inbox.MAIL_TO = String.Join(";", m.To.Select(to => to.Email).ToArray()); inbox.MAIL_CC = (!string.IsNullOrEmpty(m.Cc.ToString())) ? String.Join(";", m.Cc.Select(cc => cc.Email).ToArray()) : string.Empty; inbox.MAIL_CCN = (!string.IsNullOrEmpty(m.Bcc.ToString())) ? String.Join(";", m.Bcc.Select(Bcc => Bcc.Email).ToArray()) : string.Empty; inbox.MAIL_SUBJECT = m.Subject; inbox.MAIL_TEXT = LinqExtensions.TryParseBody(m.BodyText); inbox.DATA_INVIO = m.ReceivedDate.ToLocalTime(); inbox.DATA_RICEZIONE = m.Date.ToLocalTime(); inbox.STATUS_SERVER = (String.IsNullOrEmpty(m.MessageId)) ? ((int)MailStatusServer.DA_NON_CANCELLARE).ToString() : ((int)MailStatusServer.PRESENTE).ToString(); inbox.STATUS_MAIL = (String.IsNullOrEmpty(m.MessageId)) ? ((int)MailStatus.SCARICATA_INCOMPLETA).ToString() : ((int)MailStatus.SCARICATA).ToString(); inbox.MAIL_FILE = System.Text.Encoding.GetEncoding("iso-8859-1").GetString(m.OriginalData); inbox.FLG_ATTACHMENTS = Convert.ToInt16(m.Attachments.Count > 0).ToString(); inbox.FOLDERID = String.IsNullOrEmpty(m.HeaderFields["X-Ricevuta"]) ? 1 : 3; inbox.FOLLOWS = LinqExtensions.TryParseFollows(m.HeaderFields); inbox.MSG_LENGTH = m.OriginalData.Length; inbox.FOLDERTIPO = "I"; inbox.FOLLOWS = LinqExtensions.TryParseFollows(m.HeaderFields); return(inbox); }
public MessageForm(ActiveUp.Net.Mail.Message message) { InitializeComponent(); _message = message; LoadMessage(); }
/// <summary> /// Event fired when a message has been sent. /// </summary> /// <param name="message">The message that has been sent.</param> public MessageSentEventArgs(ActiveUp.Net.Mail.Message message) { this._message = message; }
/// <summary> /// Method for create the selected as a ActiveUp.Net.Mail.Message. /// </summary> /// <returns>The ActiveUp.Net.Mail.Message object.</returns> private ActiveUp.Net.Mail.Message CreateSelectedMessage() { ActiveUp.Net.Mail.Message message = new ActiveUp.Net.Mail.Message(); MailMessage mailMessage = this.rightSpine1.GetSelectedMessage(); if (mailMessage != null) { Facade facade = Facade.GetInstance(); ActiveUp.MailSystem.DesktopClient.AccountSettings.AccountInfo accInfo = facade.GetDefaultAccountInfo(); if (accInfo != null) { message.From.Email = accInfo.EmailAddress; } string separator = ","; string[] recipients = mailMessage.To.Split(separator.ToCharArray()); foreach (string r in recipients) { // We assign the recipient email message.To.Add(r); } // We assign the subject message.Subject = mailMessage.Subject; // We assign the body text message.BodyText.Text = this.rightSpine1.GetSelectedMessageBody(); } return message; }
/// <summary> /// Adds a Message object to the collection. Can be useful to use the GetBindableTable() method with message from different sources. /// </summary> /// <param name="msg"></param> public void Add(ActiveUp.Net.Mail.Message msg) { this.List.Add(msg); }
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"); } }
public Comunicazioni(TipoCanale canaleType, String sottoTitolo, ActiveUp.Net.Mail.Message msg, String utente, int folderId, string folderTipo) { #region "sottotitolo" if (!String.IsNullOrEmpty(sottoTitolo)) { this.RefIdSottotitolo = Convert.ToInt64(sottoTitolo); } #endregion #region "mail" MailContent mail = new MailContent(); this.MailComunicazione = mail; #region "sender" mail.MailSender = msg.From.Email; #endregion #region "refs" mail.MailRefs = new List <MailRefs>(); List <MailRefs> lR = new List <MailRefs>(); var to = from to0 in msg.To select new MailRefs { MailDestinatario = to0.Email, TipoRef = AddresseeType.TO }; if (to.Count() > 0) { lR.AddRange(to); } var cc = from cc0 in msg.Cc select new MailRefs { MailDestinatario = cc0.Email, TipoRef = AddresseeType.CC }; if (cc.Count() > 0) { lR.AddRange(cc); } var ccn = from ccn0 in msg.Bcc select new MailRefs { MailDestinatario = ccn0.Email, TipoRef = AddresseeType.CCN }; if (ccn.Count() > 0) { lR.AddRange(ccn); } if (lR.Count > 0) { mail.MailRefs = lR; } #endregion #region "subject" mail.MailSubject = msg.Subject; #endregion #region "body" mail.MailText = !String.IsNullOrEmpty(msg.BodyHtml.Text) ? msg.BodyHtml.Text : msg.BodyText.Text; #endregion #region "reply" if (!String.IsNullOrEmpty(msg.InReplyTo) && !String.IsNullOrEmpty(msg.InReplyTo.Trim())) { string follows = msg.InReplyTo.Trim(); if (follows.StartsWith("<")) { follows = follows.Substring(1); } if (follows.EndsWith(">")) { follows = follows.Substring(0, follows.Length - 1); } long?flw = null; long flwout = 0; if (long.TryParse(follows.Split('.')[0], out flwout)) { flw = flwout; } mail.Follows = flw; } #endregion #endregion #region "attachments" List <ComAllegato> all = null; if (msg.Attachments.Count > 0) { all = new List <ComAllegato>(); for (int j = 0; j < msg.Attachments.Count; j++) { ActiveUp.Net.Mail.MimePart mp = msg.Attachments[j]; ComAllegato a = new ComAllegato(); a.IdAllegato = null; a.AllegatoExt = System.IO.Path.GetExtension(mp.Filename); a.AllegatoExt = a.AllegatoExt.Replace(".", string.Empty); a.AllegatoFile = mp.BinaryContent; a.AllegatoName = System.IO.Path.GetFileNameWithoutExtension(mp.Filename); a.T_Progr = j; a.FlgInsProt = AllegatoProtocolloStatus.UNKNOWN; a.FlgProtToUpl = AllegatoProtocolloStatus.UNKNOWN; a.RefIdCom = null; all.Add(a); } } this.ComAllegati = all; #endregion #region "notifica" this.MailNotifica = msg.ReplyTo.Email; #endregion #region "utente inserimento" this.UtenteInserimento = utente; #endregion #region "flusso comunicazione" this.SetStatoComunicazione(canaleType, MailStatus.INSERTED, utente); #endregion #region Folder this.FolderId = folderId; this.FolderTipo = folderTipo; #endregion }