internal WindowFormRegionCollection this[Microsoft.Office.Interop.Outlook.Inspector inspector] { get { return((WindowFormRegionCollection)(Globals.ThisAddIn.GetFormRegions(inspector, typeof(WindowFormRegionCollection)))); } }
internal ThisRibbonCollection this[Microsoft.Office.Interop.Outlook.Inspector inspector] { get { return(this.GetRibbonContextCollection <ThisRibbonCollection>(inspector)); } }
internal WindowFormRegionCollection this[Microsoft.Office.Interop.Outlook.Inspector inspector] { get { return(Globals.AddIn.GetFormRegions <WindowFormRegionCollection>(inspector)); } }
private void button1_Click(object sender, RibbonControlEventArgs e) { // Process to receive active selection and save email files only Microsoft.Office.Interop.Outlook.Inspector currInspector = null; Microsoft.Office.Interop.Outlook.Explorer currExplorer = null; Microsoft.Office.Interop.Outlook.MailItem currMail = null; log.Debug("User selected button to SendSecure!"); try { currExplorer = Globals.ThisAddIn.Application.ActiveExplorer(); currInspector = Globals.ThisAddIn.Application.ActiveInspector(); log.Debug("Verifying we are in a Mail Editor..."); // We are in the Mail Editor... if (currInspector.CurrentItem is Microsoft.Office.Interop.Outlook.MailItem) { currMail = (Microsoft.Office.Interop.Outlook.MailItem)currInspector.CurrentItem; // There are cases where the user may be in the Subject area // and edited, and they did not tab our save the email. In // those cases, the current mail's subject would not be // updated accordingly. In order to get around that, we // need to save the current email and then pull the subject. currMail.Save(); if (currMail.Subject != null) { // Check if the send secure literal already exists prepended on // the subject...if todes...don't prepend another literal!!! string currMailSubject = currMail.Subject.ToUpper(); log.Debug("Secure Email Subject: " + currMailSubject); string secureSendLiteral = Properties.Settings.Default.secureEmailSendLiteral; if (currMailSubject.StartsWith( secureSendLiteral.ToUpper()) == false) { string subject = secureSendLiteral + currMail.Subject; log.Debug( "Prepending send secure literal to subject: " + subject); currMail.Subject = subject; } else { if (Properties.Settings.Default.addInDebug == true) { string message = "Secure Literal already exists! Skipping step to prepend..."; MessageBox.Show(message); log.Debug(message); } } } // Add check for property to send email out after the button is // clicked... if (Properties.Settings.Default.secureEmailSendEmailOnButtonClick == true) { bool sendEmail = true; log.Debug("Sending Email due to Send Secure Button click..."); if (Properties.Settings.Default.secureEmailSendConfirmation == true) { // Display the confirmation form to the user... var result = sendConfirmationForm.ShowDialog(); if (result != DialogResult.Yes) { log.Debug("User has opted to NOT send the secure email!"); sendEmail = false; } } if (sendEmail == true) { log.Debug("Sending secure email..."); currMail.Send(); } } } } catch (System.Exception ex) { MessageBox.Show(ex.Message); } }
internal WindowFormRegionCollection this[Microsoft.Office.Interop.Outlook.Inspector inspector] { get { return((WindowFormRegionCollection)(Globals.AWSNotificationMessageFormatter.GetFormRegions(inspector, typeof(WindowFormRegionCollection)))); } }
private void button1_Click(object sender, RibbonControlEventArgs e) { // Process to receive active selection and save email files only Microsoft.Office.Interop.Outlook.Inspector currInspector = null; Microsoft.Office.Interop.Outlook.Explorer currExplorer = null; Microsoft.Office.Interop.Outlook.MailItem currMail = null; log.Debug("User selected button to Report a Phish!"); if (Properties.Settings.Default.phishingEmailConfirmationPrompt == true) { var confirmResult = MessageBox.Show( "Are you sure you want to submit this email(s) as Phish?", "Confirm Phish Submission", MessageBoxButtons.YesNo); // If the user indicates NO, then we just exit out... if (confirmResult == DialogResult.No) { return; } } try { currExplorer = Globals.ThisAddIn.Application.ActiveExplorer(); currInspector = Globals.ThisAddIn.Application.ActiveInspector(); // If the inspector is NULL, assume we need to look at what is selected // in the active Outlook explorer if (currInspector == null) { log.Debug("No inspector found! Checking explorer..."); if (currExplorer != null) { if (log.IsDebugEnabled == true) { log.Debug("Found explorer...checking selected emails..."); Microsoft.Office.Interop.Outlook.MAPIFolder selectedFolder = currExplorer.CurrentFolder; String expMessage = "Your current folder is " + selectedFolder.Name + ".\n"; log.Debug(expMessage); } // Verify that the MAXIMUM or less emails have been // selected... if (currExplorer.Selection.Count > form.PhishingEmailMaxReported) { MessageBox.Show( "Please select " + form.PhishingEmailMaxReported + " or LESS emails to report!", "Maximum Reported Phishing Emails Exceeded!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else if (currExplorer.Selection.Count == 0) { MessageBox.Show( "Please select an eMail to report as a Phish!"); return; } else { // We know that there is at least as many as the MAXIMUM // NUMBER of emails selected at this point... Object selObject = null; for (int i = 0; i < currExplorer.Selection.Count; i++) { // Selection array is ONE based for some reason... selObject = currExplorer.Selection[i + 1]; if (selObject is Microsoft.Office.Interop.Outlook.MailItem) { currMail = (selObject as Microsoft.Office.Interop.Outlook.MailItem); } else { // At this point, if the select object is not a MailItem object // we just want to ignore the rest of the operation and return. string objectType = selObject.GetType().ToString(); string message = "The object selected is NOT a Mail Item. " + "This will NOT be processed as a Phish!"; MessageBox.Show(message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); log.Warn(message); return; } processMail(currMail); } } } } else { // Need to get the current "active" email item in Outlook... if (currInspector.CurrentItem is Microsoft.Office.Interop.Outlook.MailItem) { currMail = (Microsoft.Office.Interop.Outlook.MailItem)currInspector.CurrentItem; processMail(currMail); } } } catch (System.Exception ex) { MessageBox.Show(ex.Message); } }