예제 #1
0
        public ActionResult CargarMails(EmailsModel model)
        {
            String[] mails = model.Mails.ToString().Split('\n');
            MAILING email = new MAILING();
            foreach (var mail in mails)
            {
                email.email = mail;
                ctx.MAILING.Add(email);
                ctx.SaveChanges();
            }

            return RedirectToAction("Mailing");
        }
예제 #2
0
        public void EnviarMails(EmailsModel model)
        {
            IQueryable<MAILING> listEmails = ctx.MAILING.Where(m => m.email != null).OrderByDescending(m => m.id).Take(10);

            List<string> listaMails = new List<string>();
            foreach (var email in listEmails)
            {
                listaMails.Add(email.email.Trim());
                ctx.MAILING.Remove(email);
            }
            ctx.SaveChanges();

            EmailHelper.sendEmail(null, listaMails.ToArray<string>(), model.Subject.ToString(), model.Body.ToString());

            //            return RedirectToAction("Mailing");
        }