private void OnItemSend(object Item, ref bool Cancel) { var mailItem = new WsMailItem(Item); dynamic activeInspector = Globals.Application.ActiveInspector(); try { if (!Utils.HasBeenProcessedByInteractiveProtect(mailItem) && mailItem.Attachments != null && mailItem.Attachments.Count > 0) { var applyExternally = OptionApi.GetBool("InteractiveProtectApplyOptionsOnExternal"); var applyInternally = OptionApi.GetBool("InteractiveProtectApplyOptionsOnInternal"); if (applyExternally || applyInternally) { var recipientProxy = new OutlookRecipientsProxy(mailItem); var isInternal = recipientProxy.IsInternal(); if (isInternal && applyInternally) { ApplyInteractiveProtectOptionsOnSend(mailItem, activeInspector.UnSafeInspector); } else if (!isInternal && applyExternally) { ApplyInteractiveProtectOptionsOnSend(mailItem, activeInspector.UnSafeInspector); } } } else { Utils.SetMimeHeaderForProtectServer(mailItem); } MapiProperties.Delete(mailItem, Constants.ProcessedByInteractiveProtect); HandleSecureFileTransfer(activeInspector.Id, mailItem, out Cancel); } catch (Exception e) { if (!MailClientWorkerBase.ShouldContinueAfterException(e)) { Cancel = true; } Logger.LogError(e); } }
private void Initialise(MSOutlook.MailItem mailItem, bool bUseCache) { if (null == mailItem) throw new ArgumentNullException("mailItem"); m_oif = new OutlookIImplFactory(); m_outlookMail = mailItem; if (null == m_outlookMail) throw new ArgumentNullException("m_outlookMail"); m_RecipientsProxy = new OutlookRecipientsProxy(m_outlookMail, bUseCache); m_outlookAttachmentsProxy = new OutlookAttachmentsProxy(m_outlookMail); m_bIsValid = true; }