public ArchiveEmailAction( UserSession session, clsEmailArchive emailToArchive, EmailArchiveType archiveType, List <string> contactIds) : base(5) { this.session = session; this.emailToArchive = emailToArchive; this.achiveType = archiveType; this.contactIds.AddRange(contactIds); }
private clsEmailArchive SerialiseEmailObject(Outlook.MailItem mail, EmailArchiveType archiveType) { clsEmailArchive mailArchive = new clsEmailArchive(SuiteCRMUserSession, Log); mailArchive.From = ExtractSmtpAddressForSender(mail); mailArchive.To = string.Empty; Log.Info($"EmailArchiving.SerialiseEmailObject: serialising mail {mail.Subject} dated {mail.SentOn}."); foreach (Outlook.Recipient objRecepient in mail.Recipients) { string address = GetSmtpAddress(objRecepient); if (mailArchive.To == string.Empty) { mailArchive.To = address; } else { mailArchive.To += ";" + address; } } mailArchive.OutlookId = mail.EntryID; mailArchive.Subject = mail.Subject; mailArchive.Sent = DateTimeOfMailItem(mail, "autoOUTBOUND"); mailArchive.Body = mail.Body; mailArchive.HTMLBody = mail.HTMLBody; mailArchive.ArchiveType = archiveType; if (settings.ArchiveAttachments) { foreach (Outlook.Attachment objMailAttachments in mail.Attachments) { mailArchive.Attachments.Add(new clsEmailAttachments { DisplayName = objMailAttachments.DisplayName, FileContentInBase64String = GetAttachmentBytes(objMailAttachments, mail) }); } } return(mailArchive); }
private void ArchiveEmailThread(clsEmailArchive objEmail, EmailArchiveType archiveType, string strExcludedEmails = "") { try { if (SuiteCRMUserSession != null) { while (SuiteCRMUserSession.AwaitingAuthentication == true) { Thread.Sleep(1000); } if (SuiteCRMUserSession.IsLoggedIn) { objEmail.SuiteCRMUserSession = SuiteCRMUserSession; objEmail.Save(strExcludedEmails); } } } catch (Exception ex) { Log.Error("ThisAddIn.ArchiveEmailThread", ex); } }
private clsEmailArchive SerialiseEmailObject(Outlook.MailItem mail, EmailArchiveType archiveType) { clsEmailArchive mailArchive = new clsEmailArchive(); mailArchive.From = mail.SenderEmailAddress; mailArchive.To = ""; Log.Info($"EmailArchiving.SerialiseEmailObject: serialising mail {mail.Subject} dated {mail.SentOn}."); foreach (Outlook.Recipient objRecepient in mail.Recipients) { if (mailArchive.To == "") { mailArchive.To = objRecepient.Address; } else { mailArchive.To += ";" + objRecepient.Address; } } mailArchive.Subject = mail.Subject; mailArchive.Body = mail.Body; mailArchive.HTMLBody = mail.HTMLBody; mailArchive.ArchiveType = archiveType; if (settings.ArchiveAttachments) { foreach (Outlook.Attachment objMailAttachments in mail.Attachments) { mailArchive.Attachments.Add(new clsEmailAttachments { DisplayName = objMailAttachments.DisplayName, FileContentInBase64String = GetAttachmentBytes(objMailAttachments, mail) }); } } return(mailArchive); }