public ActionResult SendMail(UI.Models.MessagingObjectModel.JObsBulkMail maildata) { Business.ApplicationService.AppServiceClient appclient = new Business.ApplicationService.AppServiceClient(); string recipientstring = ""; string[] recipients = maildata.recipients.Split(','); foreach (string str in recipients) { if (str.ToLower() != "undefined" && str.Length == 32) { if (recipientstring == "") { recipientstring = str; } else { recipientstring = recipientstring + "," + str; } } } Business.CoreService.IobjectServicesWebappVer2Client client = new Business.CoreService.IobjectServicesWebappVer2Client(); List <Business.ApplicationService.mailattachment> attachments = new List <Business.ApplicationService.mailattachment>(); string companyemail = ""; try { companyemail = Session["companyemail"].ToString(); } catch { companyemail = "mailer@" + Session["companyname"].ToString() + ".com"; } Business.ApplicationService.AppRestResponse response = appclient.SendComplexMessage(recipientstring, companyemail, "", maildata.messagebody.ToString(), maildata.mailsubject, attachments.ToArray(), Session["usertoken"].ToString()); string[] jobs = maildata.jobs.Split(';'); foreach (string singlejob in jobs) { if (singlejob.Length == 32) { appclient.Updateemailstatus(singlejob, 1); } } return(Redirect(Request.UrlReferrer.ToString())); }
public ActionResult SendMail(UI.Models.MessagingObjectModel.JObsBulkMail maildata) { Business.ApplicationService.AppServiceClient appclient = new Business.ApplicationService.AppServiceClient(); string recipientstring = ""; string[] recipients = maildata.recipients.Split(','); foreach (string str in recipients) { if (str.ToLower() != "undefined" && str.Length == 32) { if (recipientstring == "") { recipientstring = str; } else { recipientstring = recipientstring + "," + str; } } } Business.CoreService.IobjectServicesWebappVer2Client client = new Business.CoreService.IobjectServicesWebappVer2Client(); List<Business.ApplicationService.mailattachment> attachments = new List<Business.ApplicationService.mailattachment>(); string companyemail = ""; try { companyemail = Session["companyemail"].ToString(); } catch { companyemail = "mailer@" + Session["companyname"].ToString() + ".com"; } Business.ApplicationService.AppRestResponse response = appclient.SendComplexMessage(recipientstring, companyemail, "", maildata.messagebody.ToString(), maildata.mailsubject, attachments.ToArray(), Session["usertoken"].ToString()); string[] jobs = maildata.jobs.Split(';'); foreach (string singlejob in jobs) { if (singlejob.Length == 32) { appclient.Updateemailstatus(singlejob, 1); } } return Redirect(Request.UrlReferrer.ToString()); }