Exemplo n.º 1
0
 public EmailAccount(MailProcess _mail1)
 {
     _mail = _mail1;
 }
Exemplo n.º 2
0
        public void InitConfiguration()
        {
            try
            {
                string tmpInterval = ConfigurationManager.AppSettings["ScanInterval"];
                if (tmpInterval != null)
                {
                    int.TryParse(tmpInterval, out SCAN_INTERNAL);
                }

                mailServer = new MailProcess();
                string emailSender = ConfigurationManager.AppSettings["EmailSender"];
                string mailServerIp = ConfigurationManager.AppSettings["MailServerIp"];
                string emailUserName = ConfigurationManager.AppSettings["EmailUserName"];
                string emailPassword = ConfigurationManager.AppSettings["EmailPassword"];
                string mailServicePort = ConfigurationManager.AppSettings["MailServicePort"];
                string enableSSL = ConfigurationManager.AppSettings["EnableSSL"];

                if (emailSender != null)
                {
                    mailServer.EmailSend = emailSender;
                }

                if (mailServerIp != null)
                {
                    mailServer.AddressMailServer = mailServerIp;
                }

                if (emailUserName != null)
                {
                    mailServer.EmailUsername = emailUserName;
                }

                if (emailPassword != null)
                {
                    mailServer.EmailPassword = emailPassword;
                }

                if (mailServicePort != null)
                {
                    mailServer.Port = Convert.ToInt32(mailServicePort);
                }

                if (enableSSL != null)
                {
                    if (enableSSL.ToUpper() == "true".ToUpper())
                    {
                        mailServer.EnableSsl = true;
                    }
                    else
                    {
                        mailServer.EnableSsl = false;
                    }
                }

                Logger.Logger.LogToFile(LogFileType.TRACE, "START SUCCESS...");

                Task.Factory.StartNew(() => SendNotificationToCustomer());

            }
            catch (Exception ex)
            {
                Logger.Logger.LogExceptionToFile(ex);
            }
        }