Пример #1
0
 private static void EmailErrors(string message, string email)
 {
     try
     {
         CuUtilitiesContext cu = new CuUtilitiesContext();
         var         settings  = cu.SmtpSettings.FirstOrDefault(s => s.EmailAddress == "dfcusmtp");
         SmtpClient  sc        = GetSmtp(settings);
         MailMessage msg       = new MailMessage();
         msg.From = new MailAddress(settings.Domain);
         msg.To.Add(new MailAddress(email));
         msg.Subject    = "Consumer Loan Failed";
         msg.IsBodyHtml = true;
         msg.Body       = message;
         sc.Send(msg);
     }
     catch
     {
     }
 }
Пример #2
0
        private static void EmailAfter(int count)
        {
            CuUtilitiesContext cu = new CuUtilitiesContext();
            var        settings   = cu.SmtpSettings.FirstOrDefault(s => s.EmailAddress == "dfcusmtp");
            SmtpClient sc         = GetSmtp(settings);

            MailMessage           msg           = new MailMessage();
            MailAddressCollection toAddressList = new MailAddressCollection();

            msg.From = new MailAddress(settings.Domain);
            msg.To.Add("*****@*****.**");

            msg.Subject = "Consumer Loan Daily Count";
            msg.Body    =
                "<div style='font-family:Calibri;'>" +
                $"   Consumer Loans finished successfullly.  Number of loans inserted: {count}" +
                "   <br />" +
                "   <br />" +
                "</div>";
            msg.IsBodyHtml = true;
            sc.Send(msg);
        }