Esempio n. 1
0
        public TestResult DoTest()
        {
            Outlook.Application application = null;
            DateTime startTime = DateTime.Now;
            try
            {
                // start outlook
                application = new Outlook.Application();
                NetOffice.OutlookSecurity.Supress.Enabled = true;

                Outlook.TaskItem newTask = application.CreateItem(OlItemType.olTaskItem) as Outlook.TaskItem;
                newTask.Subject = "Test item";
                newTask.Body = "hello";
                newTask.DueDate = DateTime.Now;
                newTask.Importance = OlImportance.olImportanceHigh;
                newTask.Close(OlInspectorClose.olDiscard);

                return new TestResult(true, DateTime.Now.Subtract(startTime), "", null, "");
            }
            catch (Exception exception)
            {
                return new TestResult(false, DateTime.Now.Subtract(startTime), exception.Message, exception, "");
            }
            finally
            {
                if (null != application)
                {
                    application.Quit();
                    application.Dispose();
                }
                NetOffice.OutlookSecurity.Supress.Enabled = false;
            }
        }
Esempio n. 2
0
        public TestResult DoTest()
        {
            Outlook.Application application = null;
            DateTime            startTime   = DateTime.Now;

            try
            {
                // start outlook
                application = new Outlook.Application();
                NetOffice.OutlookSecurity.Suppress.Enabled = true;

                // Create a new MailItem.
                Outlook.MailItem mailItem = application.CreateItem(OlItemType.olMailItem) as Outlook.MailItem;

                // prepare item and send
                mailItem.Recipients.Add("*****@*****.**");
                mailItem.Subject = "NetOffice Test Mail";
                mailItem.Body    = "This is a NetOffice test mail from the MainTests.(C#)";
                mailItem.Send();

                return(new TestResult(true, DateTime.Now.Subtract(startTime), "", null, ""));
            }
            catch (Exception exception)
            {
                return(new TestResult(false, DateTime.Now.Subtract(startTime), exception.Message, exception, ""));
            }
            finally
            {
                if (null != application)
                {
                    application.Quit();
                    application.Dispose();
                }
            }
        }
Esempio n. 3
0
 public override void Run()
 {
     try
     {
         if (!(this.Owner is LeadDetailController))
         {
             return;
         }
         LeadDetailController leadPresenter = (LeadDetailController)this.Owner;
         LateBindingApi.Core.Factory.Initialize();
         Outlook.Application outlookApplication = new Outlook.Application();
         Outlook.MailItem    KatrinEmal         = outlookApplication.CreateItem(OlItemType.olMailItem) as Outlook.MailItem;
         object emailToObject = leadPresenter.ObjectEntity.GetType().GetProperty("EmailAddress").GetValue(leadPresenter.ObjectEntity, null);
         string emailTo       = emailToObject == null ? string.Empty : emailToObject.ToString();
         if (!string.IsNullOrEmpty(emailTo))
         {
             KatrinEmal.Recipients.Add(emailTo);
         }
         KatrinEmal.Importance = OlImportance.olImportanceNormal;
         KatrinEmal.Display();
     }
     catch (Exception ex)
     {
         MessageService.ShowException(ex, ResourceService.GetString("EmailExceptionTip"));
     }
 }
Esempio n. 4
0
        public TestResult DoTest()
        {
            Outlook.Application application = null;
            DateTime startTime = DateTime.Now;
            try
            {
                // start outlook
                application = new Outlook.Application();
                NetOffice.OutlookSecurity.Supress.Enabled = true;

                // Create a new MailItem.
                Outlook.MailItem mailItem = application.CreateItem(OlItemType.olMailItem) as Outlook.MailItem;

                // prepare item and send
                mailItem.Recipients.Add("*****@*****.**");
                mailItem.Subject = "NetOffice Test Mail";
                mailItem.Body = "This is a NetOffice test mail from the MainTests.(C#)";
                mailItem.Send();

                return new TestResult(true, DateTime.Now.Subtract(startTime), "", null, "");
            }
            catch (Exception exception)
            {
                return new TestResult(false, DateTime.Now.Subtract(startTime), exception.Message, exception, "");
            }
            finally
            {
                if (null != application)
                {
                    application.Quit();
                    application.Dispose();
                }
                NetOffice.OutlookSecurity.Supress.Enabled = false;
            }
        }
Esempio n. 5
0
        private void buttonStartExample_Click(object sender, EventArgs e)
        {
            // start outlook by trying to access running application first
            Outlook.Application outlookApplication = new Outlook.Application(true);

            // create MailItem and register close event
            Outlook.MailItem mailItem = outlookApplication.CreateItem(OlItemType.olMailItem) as Outlook.MailItem;
            mailItem.CloseEvent += new NetOffice.OutlookApi.MailItem_CloseEventHandler(mailItem_CloseEvent);

            // BodyFormat is not available in Outlook 2000, we check at runtime the property is available
            if (mailItem.EntityIsAvailable("BodyFormat"))
            {
                mailItem.BodyFormat = OlBodyFormat.olFormatPlain;
            }
            mailItem.Body    = "ExampleBody";
            mailItem.Subject = "ExampleSubject";
            mailItem.Display();
            mailItem.Close(OlInspectorClose.olDiscard);

            // close outlook and dispose
            if (!outlookApplication.FromProxyService)
            {
                outlookApplication.Quit();
            }
            outlookApplication.Dispose();
        }
Esempio n. 6
0
        public void RunExample()
        {
            // start outlook by trying to access running application first
            // if its failed to resolve a running instance, we create a new one here
            Outlook.Application outlookApplication = COMObject.CreateByRunningInstance <Outlook.Application>();

            // create a new TaskItem.
            Outlook.TaskItem newTask = outlookApplication.CreateItem(OlItemType.olTaskItem) as Outlook.TaskItem;

            // Configure the task at hand and save it.
            newTask.Subject    = "Don't forget to check for NoScript updates";
            newTask.Body       = "check updates here: https://addons.mozilla.org/de/firefox/addon/noscript";
            newTask.DueDate    = DateTime.Now;
            newTask.Importance = OlImportance.olImportanceHigh;
            newTask.Save();

            // close outlook and dispose
            if (!outlookApplication.FromProxyService)
            {
                outlookApplication.Quit();
            }
            outlookApplication.Dispose();

            HostApplication.ShowFinishDialog("Done!", null);
        }
 public override void Run()
 {
     try
     {
         ProjectWeekReportDetailController projectWeekReportController = (ProjectWeekReportDetailController)this.Owner;
         if (!(this.Owner is ProjectWeekReportDetailController))
         {
             return;
         }
         LateBindingApi.Core.Factory.Initialize();
         Outlook.Application outlookApplication = new Outlook.Application();
         Outlook.MailItem    KatrinEmal         = outlookApplication.CreateItem(OlItemType.olMailItem) as Outlook.MailItem;
         KatrinEmal.Subject = projectWeekReportController.ObjectName;
         string emailTo = "";
         KatrinEmal.Display();
         string sourceHtmlBody = KatrinEmal.HTMLBody;
         string emailBody      = InitEmailMessage(out emailTo);
         emailBody          += sourceHtmlBody;
         KatrinEmal.HTMLBody = emailBody;
         if (!string.IsNullOrEmpty(emailTo))
         {
             KatrinEmal.Recipients.Add(emailTo);
         }
         KatrinEmal.Importance = OlImportance.olImportanceNormal;
     }
     catch (Exception ex)
     {
         MessageService.ShowException(ex, ResourceService.GetString("EmailExceptionTip"));
     }
 }
Esempio n. 8
0
        public void OnGenerateDayReport(object sender, EventArgs e)
        {
            LateBindingApi.Core.Factory.Initialize();
            Outlook.Application outlookApplication = new Outlook.Application();

            DateTime    thisDay       = DateTime.Today;
            DateTime    nextDay       = thisDay.AddDays(1);
            IEnumerable taskList      = GetTasks(thisDay);
            var         projectIdList = taskList.AsQueryable().Select("ProjectId").Cast <Guid>().Distinct <Guid>();

            if (projectIdList.ToList().Count <= 0)
            {
                XtraMessageBox.Show(Properties.Resources.NoTaskTip,
                                    Properties.Resources.Katrin,
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Information,
                                    MessageBoxDefaultButton.Button1);
                return;
            }
            foreach (Guid projectId in projectIdList)
            {
                Outlook.MailItem KatrinEmal = outlookApplication.CreateItem(OlItemType.olMailItem) as Outlook.MailItem;
                KatrinEmal.Subject = "";
                string emailTo        = "";
                string sourceHtmlBody = KatrinEmal.HTMLBody;
                KatrinEmal.HTMLBody = InitEmailMessage(out emailTo, thisDay, nextDay, projectId, taskList);
                if (!string.IsNullOrEmpty(emailTo))
                {
                    KatrinEmal.Recipients.Add(emailTo);
                }
                KatrinEmal.Importance = OlImportance.olImportanceNormal;
                KatrinEmal.Display();
            }
        }
Esempio n. 9
0
        public TestResult DoTest()
        {
            Outlook.Application application = null;
            DateTime            startTime   = DateTime.Now;

            try
            {
                // start outlook
                application = new Outlook.Application();
                NetOffice.OutlookSecurity.Suppress.Enabled = true;

                Outlook.TaskItem newTask = application.CreateItem(OlItemType.olTaskItem) as Outlook.TaskItem;
                newTask.Subject    = "Test item";
                newTask.Body       = "hello";
                newTask.DueDate    = DateTime.Now;
                newTask.Importance = OlImportance.olImportanceHigh;
                newTask.Close(OlInspectorClose.olDiscard);

                return(new TestResult(true, DateTime.Now.Subtract(startTime), "", null, ""));
            }
            catch (Exception exception)
            {
                return(new TestResult(false, DateTime.Now.Subtract(startTime), exception.Message, exception, ""));
            }
            finally
            {
                if (null != application)
                {
                    application.Quit();
                    application.Dispose();
                }
            }
        }
Esempio n. 10
0
 private static void SendMail(Outlook.Application application)
 {
     Outlook.MailItem mailItem = application.CreateItem(OlItemType.olMailItem) as Outlook.MailItem;
     mailItem.Recipients.Add("*****@*****.**");
     mailItem.Subject = "Concept Test - SuppressOutlookSecurity";
     mailItem.Body    = "This is a test mail from NetOffice concept test.";
     mailItem.Send();
 }
Esempio n. 11
0
    public static void Main(string[] args)
    {
        try
        {
            if (args.Length == 1)
            {
                // Create an Outlook application.
                Outlook._Application oApp;
                oApp = new Outlook.Application();

                // Create a new MailItem.
                Outlook._MailItem oMsg;
                oMsg = (Outlook._MailItem)oApp.CreateItem((OlItemType)NetOffice.OutlookApi.Enums.OlItemType.olMailItem);

                // set the subject to the PDF file name without the path + attached
                oMsg.Subject = Path.GetFileName(args[0]) + " attached";

                // customize these fields to add "To" address or body
                // oMsg.To =
                // oMsg.Body =

                // Add the PDF as an attachment
                string sSource      = args[0];
                string sDisplayName = Path.GetFileName(args[0]);
                string sBodyLen     = "0";

                Outlook.Attachments oAttachs = oMsg.Attachments;
                Outlook.Attachment  oAttach;
                oAttach = oAttachs.Add(sSource, OlAttachmentType.olByValue, Convert.ToInt32(sBodyLen) + 1, sDisplayName);

                // Display
                oMsg.Display(true);

                // Send
                // oMsg.Send()

                // close OutlookApi And dispose
                oApp.Quit();
                oApp.Dispose();

                // Clean up
                oApp     = null /* TODO Change to default(_) if this is not a reference type */;
                oMsg     = null /* TODO Change to default(_) if this is not a reference type */;
                oAttach  = null /* TODO Change to default(_) if this is not a reference type */;
                oAttachs = null /* TODO Change to default(_) if this is not a reference type */;
            }
        }
        catch (Exception ex)
        {
            var exception_description = string.Format("Win2PDF Send To Outlook plug-in exception {0}, stack {1}, targetsite {2}", ex.Message, ex.StackTrace, ex.TargetSite);
            System.Windows.Forms.MessageBox.Show(exception_description);
            using (EventLog eventLog = new EventLog("Application"))
            {
                eventLog.Source = "Win2PDF";
                eventLog.WriteEntry(exception_description, EventLogEntryType.Error, 101);
            }
        }
    }
Esempio n. 12
0
        public void OnSetOpportunitySuccess(object sender, EventArgs e)
        {
            LateBindingApi.Core.Factory.Initialize();
            Outlook.Application outlookApplication = new Outlook.Application();
            Outlook.MailItem    KatrinEmal         = outlookApplication.CreateItem(OlItemType.olMailItem) as Outlook.MailItem;
            string emailTo = DynamicEntity.EmailAddress;

            if (!string.IsNullOrEmpty(emailTo))
            {
                KatrinEmal.Recipients.Add(emailTo);
            }
            KatrinEmal.Importance = OlImportance.olImportanceNormal;
            KatrinEmal.Display();
        }
Esempio n. 13
0
        public TestResult DoTest()
        {
            Outlook.Application application = null;
            DateTime            startTime   = DateTime.Now;

            try
            {
                // start outlook
                application = new Outlook.Application(true);
                NetOffice.OutlookSecurity.Suppress.Enabled = true;

                Outlook.MailItem mailItem = application.CreateItem(OlItemType.olMailItem) as Outlook.MailItem;
                mailItem.CloseEvent += new NetOffice.OutlookApi.MailItem_CloseEventHandler(mailItem_CloseEvent);

                // BodyFormat is not available in Outlook 2000
                // we check at runtime is property is available
                if (mailItem.EntityIsAvailable("BodyFormat"))
                {
                    mailItem.BodyFormat = OlBodyFormat.olFormatPlain;
                }
                mailItem.Body    = "NetOffice C# Test06" + DateTime.Now.ToLongTimeString();
                mailItem.Subject = "Test06";
                mailItem.Display();
                mailItem.Close(OlInspectorClose.olDiscard);

                if (_closeEventCalled)
                {
                    return(new TestResult(true, DateTime.Now.Subtract(startTime), "", null, ""));
                }
                else
                {
                    return(new TestResult(false, DateTime.Now.Subtract(startTime), "CloseEvent not triggered.", null, ""));
                }
            }
            catch (Exception exception)
            {
                return(new TestResult(false, DateTime.Now.Subtract(startTime), exception.Message, exception, ""));
            }
            finally
            {
                if (null != application)
                {
                    if (!application.FromProxyService)
                    {
                        application.Quit();
                    }
                    application.Dispose();
                }
            }
        }
Esempio n. 14
0
        private static Outlook.MailItem BuildMail(IEnumerable <EmailRecipientDTO> recipientDtos, string subject, string body, Outlook.Application outlookApplication)
        {
            var mailItem = outlookApplication.CreateItem(OlItemType.olMailItem) as Outlook.MailItem;

            foreach (var emailRecipientDTO in recipientDtos)
            {
                var recipientToBCC = mailItem.Recipients.Add(emailRecipientDTO.Email);
                recipientToBCC.Type = (int)OlMailRecipientType.olBCC;
            }
            mailItem.Recipients.ResolveAll();
            mailItem.Subject = subject;
            mailItem.Body    = body;
            return(mailItem);
        }
        public void GenerateDayReport()
        {
            try
            {
                LateBindingApi.Core.Factory.Initialize();
                Outlook.Application outlookApplication = new Outlook.Application();

                DateTime    thisDay       = DateTime.Today;
                DateTime    nextDay       = thisDay.AddDays(1);
                IEnumerable taskList      = GetTasks(thisDay);
                var         projectIdList = taskList.AsQueryable().Select("ProjectId").Cast <Guid>().Distinct <Guid>();
                if (projectIdList.ToList().Count <= 0)
                {
                    XtraMessageBox.Show(StringParser.Parse("NoTaskTip"),
                                        StringParser.Parse("Katrin"),
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Information,
                                        MessageBoxDefaultButton.Button1);
                    return;
                }
                foreach (Guid projectId in projectIdList)
                {
                    Outlook.MailItem KatrinEmal = outlookApplication.CreateItem(OlItemType.olMailItem) as Outlook.MailItem;
                    KatrinEmal.Subject = "";
                    string emailTo = "";
                    KatrinEmal.Display();
                    string sourceHtmlBody = KatrinEmal.HTMLBody;
                    string emailBody      = InitEmailMessage(out emailTo, thisDay, nextDay, projectId, taskList);
                    emailBody          += sourceHtmlBody;
                    KatrinEmal.HTMLBody = emailBody;
                    if (!string.IsNullOrEmpty(emailTo))
                    {
                        KatrinEmal.Recipients.Add(emailTo);
                    }
                    KatrinEmal.Importance = OlImportance.olImportanceNormal;
                }
            }
            catch (Exception ex)
            {
                MessageService.ShowException(ex, ResourceService.GetString("EmailExceptionTip"));
            }
        }
Esempio n. 16
0
        private void buttonStartExample_Click(object sender, EventArgs e)
        {
            // start outlook
            Outlook.Application outlookApplication = new Outlook.Application();

            // create a new MailItem.
            Outlook.MailItem mailItem = outlookApplication.CreateItem(OlItemType.olMailItem) as Outlook.MailItem;

            // prepare item and send
            mailItem.Recipients.Add(textBoxReciever.Text);
            mailItem.Subject = textBoxSubject.Text;
            mailItem.Body = textBoxBody.Text;
            mailItem.Send();

            // close outlook and dispose
            outlookApplication.Quit();
            outlookApplication.Dispose();

            _hostApplication.ShowFinishDialog("Done!", null);
        }
Esempio n. 17
0
        private void buttonStartExample_Click(object sender, EventArgs e)
        {
            // start outlook
            Outlook.Application outlookApplication = new Outlook.Application();

            // create a new MailItem.
            Outlook.MailItem mailItem = outlookApplication.CreateItem(OlItemType.olMailItem) as Outlook.MailItem;

            // prepare item and send
            mailItem.Recipients.Add(textBoxReciever.Text);
            mailItem.Subject = textBoxSubject.Text;
            mailItem.Body    = textBoxBody.Text;
            mailItem.Send();

            // close outlook and dispose
            outlookApplication.Quit();
            outlookApplication.Dispose();

            HostApplication.ShowFinishDialog("Done!", null);
        }
Esempio n. 18
0
        public TestResult DoTest()
        {
            Outlook.Application application = null;
            DateTime startTime = DateTime.Now;
            try
            {
                // start outlook
                application = new Outlook.Application();
                NetOffice.OutlookSecurity.Supress.Enabled = true;

                Outlook.MailItem mailItem = application.CreateItem(OlItemType.olMailItem) as Outlook.MailItem;
                mailItem.CloseEvent += new NetOffice.OutlookApi.MailItem_CloseEventHandler(mailItem_CloseEvent);

                // BodyFormat is not available in Outlook 2000
                // we check at runtime is property is available
                if (mailItem.EntityIsAvailable("BodyFormat"))
                    mailItem.BodyFormat = OlBodyFormat.olFormatPlain;
                mailItem.Body = "NetOffice C# Test06" + DateTime.Now.ToLongTimeString();
                mailItem.Subject = "Test06";
                mailItem.Display();
                mailItem.Close(OlInspectorClose.olDiscard);

                if(_closeEventCalled)
                    return new TestResult(true, DateTime.Now.Subtract(startTime), "", null, "");
                else
                    return new TestResult(false, DateTime.Now.Subtract(startTime), "CloseEvent not triggered.", null, "");
            }
            catch (Exception exception)
            {
                return new TestResult(false, DateTime.Now.Subtract(startTime), exception.Message, exception, "");
            }
            finally
            {
                if (null != application)
                {
                    application.Quit();
                    application.Dispose();
                }
                NetOffice.OutlookSecurity.Supress.Enabled = false;
            }
        }
Esempio n. 19
0
        public void RunExample()
        {
            // start outlook
            Outlook.Application outlookApplication = new Outlook.Application();

            // create a new TaskItem.
            Outlook.TaskItem newTask = outlookApplication.CreateItem(OlItemType.olTaskItem) as Outlook.TaskItem;

            // Configure the task at hand and save it.
            newTask.Subject    = "Don't forget to check for NetOffice.DeveloperToolbox updates";
            newTask.Body       = "check updates here: http://netoffice.codeplex.com/releases";
            newTask.DueDate    = DateTime.Now;
            newTask.Importance = OlImportance.olImportanceHigh;
            newTask.Save();

            // close outlook and dispose
            outlookApplication.Quit();
            outlookApplication.Dispose();

            HostApplication.ShowFinishDialog("Done!", null);
        }
 public void OnGenerateWeekReport(object sender, EventArgs e)
 {
     try
     {
         LateBindingApi.Core.Factory.Initialize();
         Outlook.Application outlookApplication = new Outlook.Application();
         Outlook.MailItem    KatrinEmal         = outlookApplication.CreateItem(OlItemType.olMailItem) as Outlook.MailItem;
         KatrinEmal.Subject = this.DynamicEntity.Name;
         string emailTo = "";
         KatrinEmal.HTMLBody = InitEmailMessage(out emailTo);
         if (!string.IsNullOrEmpty(emailTo))
         {
             KatrinEmal.Recipients.Add(emailTo);
         }
         KatrinEmal.Importance = OlImportance.olImportanceNormal;
         KatrinEmal.Display();
     }
     catch
     {
     }
 }
Esempio n. 21
0
        private void buttonStartExample_Click(object sender, EventArgs e)
        {
            // start outlook
            Outlook.Application outlookApplication = new Outlook.Application();

            // create MailItem and register close event
            Outlook.MailItem mailItem = outlookApplication.CreateItem(OlItemType.olMailItem) as Outlook.MailItem;
            mailItem.CloseEvent += new NetOffice.OutlookApi.MailItem_CloseEventHandler(mailItem_CloseEvent);

            // BodyFormat is not available in Outlook 2000, we check at runtime the property is available
            if (mailItem.EntityIsAvailable("BodyFormat"))
                mailItem.BodyFormat = OlBodyFormat.olFormatPlain;
            mailItem.Body = "ExampleBody";
            mailItem.Subject = "ExampleSubject";
            mailItem.Display();
            mailItem.Close(OlInspectorClose.olDiscard);

            // close outlook and dispose
            outlookApplication.Quit();
            outlookApplication.Dispose();
        }
Esempio n. 22
0
        public void RunExample()
        {
            // start outlook
            Outlook.Application outlookApplication = new Outlook.Application();

            // create a new TaskItem.
            Outlook.TaskItem newTask = outlookApplication.CreateItem(OlItemType.olTaskItem) as Outlook.TaskItem;

            // Configure the task at hand and save it.
            newTask.Subject = "Don't forget to check for NetOffice.DeveloperToolbox updates";
            newTask.Body = "check updates here: http://netoffice.codeplex.com/releases";
            newTask.DueDate = DateTime.Now;
            newTask.Importance = OlImportance.olImportanceHigh;
            newTask.Save();

            // close outlook and dispose
            outlookApplication.Quit();
            outlookApplication.Dispose();

            _hostApplication.ShowFinishDialog("Done!", null);
        }
Esempio n. 23
0
        private void buttonStartExample_Click(object sender, EventArgs e)
        {
            // start outlook by trying to access running application first
            Outlook.Application outlookApplication = COMObject.CreateByRunningInstance <Outlook.Application>();

            // create a new MailItem.
            Outlook.MailItem mailItem = outlookApplication.CreateItem(OlItemType.olMailItem) as Outlook.MailItem;

            // prepare item and send
            mailItem.Recipients.Add(textBoxReciever.Text);
            mailItem.Subject = textBoxSubject.Text;
            mailItem.Body    = textBoxBody.Text;
            mailItem.Send();

            // close outlook and dispose
            if (!outlookApplication.FromProxyService)
            {
                outlookApplication.Quit();
            }
            outlookApplication.Dispose();

            HostApplication.ShowFinishDialog("Done!", null);
        }
Esempio n. 24
0
        public void ClickEmail()
        {
            try
            {
                var type = Data.ProviderCollection.GetType(this.Provider, this.Type);
                if (type == null) return;
                string mails = type.Email;
                if (string.IsNullOrEmpty(mails)) return;
                if (!mails.Contains("@"))
                { MessageBox.Show(mails.ToString(), "მისამართი", MessageBoxButtons.OK, MessageBoxIcon.Information); return; }
                string[] mailsarray = mails.Split(';');
                string subject = "თანხის " + this.Type + " " + this.From + " (INC" + this.Inc + ")";

                using (Outlook.Application app = new Outlook.Application())
                {
                    var mail = (Outlook.MailItem)app.CreateItem(Outlook.Enums.OlItemType.olMailItem);
                    var mailIndex = mails.IndexOf(";");
                    if (mailIndex == -1)
                        mail.To = mails;
                    else
                    {
                        mail.To = mails.Substring(0, mailIndex + 1);
                        mail.CC += mails.Substring(mailIndex);
                    }
                    mail.CC += ";" + GetEMails();
                    mail.Subject = subject;
                    mail.HTMLBody = File.ReadAllText(Path.Combine(Application.StartupPath, "conf\\OutlookBody.html")) + mail.HTMLBody;
                    string scanpath = GetScanImgPath();
                    if (File.Exists(scanpath))
                        mail.Attachments.Add(scanpath);
                    mail.Display();
                }
            }
            catch (Exception ex)
            {
                ErrorBox.Show(ex.Message, ex.StackTrace);
            }
        }