Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        public JsonResult LoadAutoCompleteEMails(string Search)
        {
            var emailList = _scheduler.GetEmailAddress("");

            List<EmailTo> EmailTo = new List<EmailTo>();

            foreach (var item in emailList)
            {
                EmailTo objEmail = new EmailTo();
                if (!string.IsNullOrEmpty(item))
                {
                    objEmail.Email_Id = item;
                    EmailTo.Add(objEmail);
                }
            }

            //string strEmailCC = "[email protected];[email protected];[email protected];[email protected];[email protected]";
            //string[] EmailIdCCs = strEmailCC.Split(';');
            //foreach (string Emailid in EmailIdCCs)
            //{
            //    EmailTo objEmailCC = new EmailTo();
            //    objEmailCC.Email_Id = Emailid;
            //    EmailTo.Add(objEmailCC);
            //}

            List<string> Emaillist = new List<string>();
            foreach (var item in EmailTo)
            {
                Emaillist.Add(item.Email_Id);
            }

            var result = Emaillist.ToArray();
            return Json(result, JsonRequestBehavior.AllowGet);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        public JsonResult AutoCompletePart(string id)
        {
            List<EmailTo> EmailTo = new List<EmailTo>();
            string strEmailCC = "[email protected];[email protected];[email protected];[email protected];[email protected]";
            string[] EmailIdCCs = strEmailCC.Split(';');
            foreach (string Emailid in EmailIdCCs)
            {
                EmailTo objEmailCC = new EmailTo();
                objEmailCC.Email_Id = Emailid;
                EmailTo.Add(objEmailCC);
            }

            List<string> Emaillist = new List<string>();
            foreach (var item in EmailTo)
            {
                Emaillist.Add(item.Email_Id);
            }

            var result = Emaillist.ToArray();
            return Json(result, JsonRequestBehavior.AllowGet);
        }