private void Send_SummaryReport_ExecuteCode(object sender, EventArgs e) { string nazwaBiura = DB.admSetup.GetValue(workflowProperties.Web, "BR_NAZWA"); StringBuilder sb = new StringBuilder(); foreach (Recipient recipient in alRecipients) { sb.Append(recipient.GetBody(string.Empty)); sb.Append("<hr>"); } if (!oMsg.Body.Contains("[[Body]]")) { oMsg.Body = oMsg.Body + "[[Body]]"; } StringBuilder sb2 = new StringBuilder(oMsg.Body); sb2.Replace("[[Body]]", sb.ToString()); sb2.Replace("[[NazwaBiura]]", nazwaBiura); oMsg.Body = sb2.ToString(); oMsg.IsBodyHtml = true; SPListItem m = WysylkaMonitu.Send(workflowProperties.Web, oMsg, 0); HistoryDescription = string.Format("Raport zbiorczy wysłany do {0}", oMsg.To[0].Address); HistoryOutcome = string.Format("MessageId={0}", m.ID); }
private void Create_RecipientsReports_ExecuteCode(object sender, EventArgs e) { string nazwaBiura = DB.admSetup.GetValue(workflowProperties.Web, "BR_NAZWA"); foreach (Recipient recipient in alRecipients) { MailMessage msg = new MailMessage() { Subject = recipient.GetSubject(), Body = recipient.GetBody(WysylkaMonitu.Get_MessageLayout(workflowProperties.Web)), }; foreach (MailAddress ma in recipient.To()) { msg.To.Add(ma); } StringBuilder sb = new StringBuilder(msg.Body); sb.Replace("[[NazwaBiura]]", nazwaBiura); msg.Body = sb.ToString(); msg.IsBodyHtml = true; //add standard layout sb = new StringBuilder(BLL.dicSzablonyKomunikacji.Get_HTMLByKod(workflowProperties.Web, "EMAIL_DEFAULT_BODY")); sb.Replace("___FOOTER___", string.Empty); sb.Replace("___BODY___", msg.Body); msg.Body = sb.ToString(); SPListItem m = WysylkaMonitu.Send(workflowProperties.Web, msg, recipient.ID); } }