Exemplo n.º 1
0
        public ActionResult Send(SentEmailViewModel model)
        {
            List <SentEmailViewModel> lst = new List <SentEmailViewModel>();

            string[] multipleTo = model.To.Split(';');
            foreach (var to in multipleTo)
            {
                lst.Add(new SentEmailViewModel()
                {
                    To = to
                });
            }
            lst.ForEach(m => m.EmailId = model.EmailId);
            lst.ForEach(m => m.Body    = model.Body);
            lst.ForEach(m => m.Subject = model.Subject);
            lst.ForEach(m => m.CC      = model.CC);
            //lst.lstSentEmails.ForEach(m => m.UserID = model.UserID);
            lst.ForEach(m => m.Date = DateTime.Now);
            if (Email.send(model))
            {
                _iEmailService.AddSentEmails(lst);
            }
            return(RedirectToAction("Index", "Email"));
        }