private void EmailEveryone(MonthlyValidationReminderRecords records) { EmployeeInfo e = new EmployeeInfo(); Employees userList = e.GetAllUserEmails(); foreach (Employee user in userList) { string email = user.Email; StringBuilder emailBuilder = new StringBuilder(); string templatePath = HttpContext.Current.Server.MapPath(AppConfiguration.Current.MonthlyValidationReminder); string templateText = File.ReadAllText(templatePath); DotLiquid.Template.RegisterSafeType(typeof(MonthlyValidationReminderRecord), new string[] { "FacilityName", "EmmittingAssetName", "UnitOfMeasure", "ValidationPeriod", "EmissionVolume", "FormattedVolume" }); Template template = Template.Parse(templateText); string date = DateTime.Now.AddMonths(-1).ToString("MMMM yyyy"); string html = template.Render(Hash.FromAnonymousObject(new { Date = date, SystemAdmin = config.SystemAdmin, Kickouts = records })); if (email != null) SendEmail(html, config.MonthyValidationReminderSubject, config.SystemAdmin, email); else EmailTechnicalError("Could not send kickout report to: " + user); } }