Exemplo n.º 1
0
        private void SendSmtpMail()
        {
            _view.ProgressMessage   = "Sending email via SMTP...";
            _view.EnableEmailButton = false;
            _view.ShowProgressBar   = true;

            try
            {
                var emailText  = BuildReportString();
                var mailSender = new MailSender(ReportInfo, _view);
                mailSender.SendSmtp(emailText);
            }
            catch (Exception exception)
            {                           // most/all exceptions will be thrown in the MailSender - this is just a double backup
                _view.Completed(false);
                _view.ShowError("Unable to setup email using SMTP" + Environment.NewLine + exception.Message, exception);
            }
        }
        void SendSmtpMail()
        {
            _view.ProgressMessage   = "Sending email via SMTP...";
            _view.EnableEmailButton = false;
            _view.ShowProgressBar   = true;

            try
            {
                var emailText  = BuildReportString();
                var mailSender = new MailSender(ReportInfo, _view);
                mailSender.SendSmtp(emailText);
            }
            catch (Exception exception)
            {                           // this would be an exception in the setup, the sending has it's own failure event
                _view.Completed(false);
                _view.ShowError("Unable to setup email using SMTP" + Environment.NewLine + exception.Message, exception);
            }
        }