RegisterLogin

Information

For your security
Never give out any banking or other information that is considered personal anywhere on the site.


Integration in Office Outlook 2019



The integration has two goal:
1. Scan the email not only when received but also the past emails
2. Don't waste CPU time and IO disk to scan by outside, but scan the emails from inside the Thunderbird database


How it works



The emails are sent by socket to the service-mode application


See the code



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using Outlook = Microsoft.Office.Interop.Outlook;
using Office = Microsoft.Office.Core;
using System.Windows.Forms;
using Giesa.Base;
using OpenAVUserMode.servicecom;

namespace MultiAntivirusForOutlook
{
    public partial class ThisAddIn
    {
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            this.Application.NewMail += new Microsoft.Office.Interop.Outlook.ApplicationEvents_11_NewMailEventHandler(ThisApplication_NewMail);
        }

        private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
        {
            // Nota: Outlook non genera più questo evento. Se è presente codice che 
            //    deve essere eseguito all'arresto di Outlook, vedere https://go.microsoft.com/fwlink/?LinkId=506785
        }

        private void ThisApplication_NewMail()
        {
            Outlook.MAPIFolder inBox = this.Application.ActiveExplorer()
                .Session.GetDefaultFolder(Outlook
                .OlDefaultFolders.olFolderInbox);
            Outlook.Items inBoxItems = inBox.Items;
            Outlook.MailItem newEmail = null;
            inBoxItems = inBoxItems.Restrict("[Unread] = true");
            VFS vfs = new VFS();
            try
            {
                foreach (object collectionItem in inBoxItems)
                {
                    newEmail = collectionItem as Outlook.MailItem;
                    if (newEmail != null)
                    {
                        if (newEmail.Attachments.Count > 0)
                        {
                            for (int i = newEmail.Attachments.Count; i > 0 ; i--)
                            {
                                GString gs = new GString();
                                gs.initRandomUUID();
                                newEmail.Attachments[i].SaveAsFile
                                    (@"C:\ProgramData\AntiVirusScanning\" +
                                    gs.toString());//newEmail.Attachments[i].FileName
                                ManualScan MS = new ManualScan();
                                InfoRetBool scan = MS.ScanSyncFile("C:\\ProgramData\\AntiVirusScanning\\" + gs.toString());

                                if (scan.noFault())
                                {
                                    if (scan.retVar)
                                    {
                                        //don't remove the file, the service will do it after quarantene it
                                        newEmail.Attachments.Remove(i);
                                    }
                                    else
                                    {
                                        vfs.FileKillIfExist(new MAC("IntegrationOutlook"), "/C:/ProgramData/AntiVirusScanning/" + gs.toString());
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                /*string errorInfo = (string)ex.Message.Substring(0, 11);
                if (errorInfo == "Cannot save")
                {
                    //MessageBox.Show(@"Create Folder C:\TestFileSave");
                }*/
            }
        }


        #region Codice generato da VSTO

        /// 
        /// Metodo richiesto per il supporto della finestra di progettazione. Non modificare
        /// il contenuto del metodo con l'editor di codice.
        /// 
        private void InternalStartup()
        {
            this.Startup += new System.EventHandler(ThisAddIn_Startup);
            this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
        }
        
        #endregion
    }
}


Submit



If you want to integrate your application with MultiAntivirus plese contact us, we will help you for the integration

Application name
eMail
Additional note

ADS
we are looking for sponsors, please contact us you may see your advertisement here








This site uses cookies.
Some of these cookies are essential, while others help us to improve your experience by providing insights into how the site is begin used.
For more detailed information on the cookies we use, please check our Privacy Policy
Necesary Cookies
Necessary cookies enable core functionality. The website cannot function properly without these cookies.
Analytical cookies help us to improve our website by collecting and reporting information on its usage.
Social Sharing Cookies
We use some social sharing plugins, to allow uou to share certain pages of our website on social mesia.
These plugins place cookies so that you can correctly view how many times a page has been readed