public JsonResult Event_MailSentNew(SchedulerEmailModel Emailmodel) { List<EmailTo> EmailTo = new List<EmailTo>(); List<EmailCC> EmailCC = new List<EmailCC>(); List<EmailBCC> EmailBCC = new List<EmailBCC>(); String strSubject = Emailmodel.MailSubject; String strMailFrom = Emailmodel.MailFrom; String strEmailCC = string.Empty; String strEmailBCC = string.Empty; String strEmailTo = Emailmodel.MailTo; string[] EmailIdTos = strEmailTo.Split(','); foreach (string Emailid in EmailIdTos) { EmailTo objEmailTo = new EmailTo(); objEmailTo.Email_Id = Emailid; EmailTo.Add(objEmailTo); } if (!string.IsNullOrEmpty(Emailmodel.MailCC)) { strEmailCC = Emailmodel.MailCC; string[] EmailIdCCs = strEmailCC.Split(','); foreach (string Emailid in EmailIdCCs) { EmailCC objEmailCC = new EmailCC(); objEmailCC.Email_Id = Emailid; EmailCC.Add(objEmailCC); } } if(!string.IsNullOrEmpty(Emailmodel.MailBCC)) { strEmailBCC = Emailmodel.MailBCC; string[] EmailIdBCCs = strEmailBCC.Split(','); foreach (string Emailid in EmailIdBCCs) { EmailBCC objEmailBCC = new EmailBCC(); objEmailBCC.Email_Id = Emailid; EmailBCC.Add(objEmailBCC); } } var resposne = Email.SendEmailFromMailGunServer(strSubject, Emailmodel.MailBody, EmailTo, EmailCC, EmailBCC, strMailFrom); string resposecode = resposne.StatusCode.ToString(); // saving mail content in the Emailinbox table if (resposecode.Equals("OK")) { int ret = _scheduler.InsertEventMailToEmailInbox(strEmailTo, strMailFrom, strEmailCC, strEmailBCC, strSubject, Emailmodel.MailBody); return Json("200", JsonRequestBehavior.AllowGet); } else { return Json("100", JsonRequestBehavior.AllowGet); } }
public JsonResult Event_MailSent(string MailTo, string MailCC, string MailBCC, string MailSubject,string MailBody) { string EventTitle = string.Empty; string EventLocation = string.Empty; string EventDescrption = string.Empty; string Organizer = string.Empty; string Startdate = string.Empty; string Enddate = string.Empty; string Mail_To = string.Empty; string Mail_From = string.Empty; string Mail_Subject = string.Empty; //////////////////////////// Code for sending Email /////////////////////////////////////////////////////////////// List<EmailTo> EmailTo = new List<EmailTo>(); List<EmailCC> EmailCC = new List<EmailCC>(); List<EmailBCC> EmailBCC = new List<EmailBCC>(); string strEmailTo = "[email protected];[email protected];[email protected];[email protected]"; string[] EmailIdTos = strEmailTo.Split(';'); foreach (string Emailid in EmailIdTos) { EmailTo objEmailTo = new EmailTo(); objEmailTo.Email_Id = Emailid; EmailTo.Add(objEmailTo); } string strEmailCC = "[email protected];[email protected];[email protected];[email protected]"; string[] EmailIdCCs = strEmailCC.Split(';'); foreach (string Emailid in EmailIdCCs) { EmailCC objEmailCC = new EmailCC(); objEmailCC.Email_Id = Emailid; EmailCC.Add(objEmailCC); } string strEmailBCC = "[email protected];[email protected];[email protected];[email protected]"; string[] EmailIdBCCs = strEmailBCC.Split(';'); foreach (string Emailid in EmailIdBCCs) { EmailBCC objEmailBCC = new EmailBCC(); objEmailBCC.Email_Id = Emailid; EmailBCC.Add(objEmailBCC); } // var resposne2 = Email.SendEmailFromMailGunServer("TestSubject", MailBody, EmailTo, EmailCC, EmailBCC, "*****@*****.**"); ////////////////////////////////////////////////////////////////////////////////////////// return Json("200", JsonRequestBehavior.AllowGet); }