Ejemplo n.º 1
0
        public ExceptionReport CreateExceptionReport()
        {
            IList <SysInfoResult> sysInfoResults = GetOrFetchSysInfoResults();
            EmailBuilder          reportBuilder  = new EmailBuilder(_reportInfo, _sysInfoResults);

            return(reportBuilder.Build());
        }
        public void SendSmtp(string exceptionReport)
        {
            EmailBuilder en         = new EmailBuilder(_reportInfo);
            string       x          = en.EncryptCrypto(_reportInfo.SmtpPassword);
            string       n          = en.DecryptCrypto(_reportInfo.SmtpPassword).Trim();
            var          smtpClient = new SmtpClient(_reportInfo.SmtpServer)
            {
                DeliveryMethod = SmtpDeliveryMethod.Network,
                Credentials    = new System.Net.NetworkCredential(_reportInfo.SmtpFromAddress, _reportInfo.SmtpPassword),
                Host           = _reportInfo.SmtpServer,
            };
            //smtpClient.EnableSsl = true;
            //smtpClient.Port = 465;
            //smtpClient.UseDefaultCredentials = false;
            var mailMessage = CreateMailMessage(exceptionReport);

            smtpClient.SendAsync(mailMessage, null);
        }