protected bool InstantEmail_RefundReport() { #region Chilkat MailMan using (Chilkat.MailMan mailman = new Chilkat.MailMan()) { mailman.UnlockComponent("SGREENWOODMAILQ_FuY9K2d92R8F"); mailman.SmtpHost = Connection.GetSmtpHost(); #region Chilkat Email using (Chilkat.Email email = new Chilkat.Email()) { int tzOffSet = (DateTime.Now.IsDaylightSavingTime()) ? -4 : -5; DateTime dt = DateTime.Parse(CreateDate.Text); DateTime dtNow = DateTime.UtcNow; email.AddHeaderField("X-Priority", "1 (High)"); email.Subject = "ARC Portal - Refund Report"; email.AddHeaderField("DataExchange-Automated", "LMS_JobNotice JobID:03"); email.AddHeaderField("Portal-Automated", "Script-ARCRR"); String emailPath = "emails/"; String emailFile = "portal_arc_refund_processed.html"; String htmlBody = ""; //System.IO.StreamReader rdr = new StreamReader(Server.MapPath("~") + emailPath + emailFile); System.IO.StreamReader rdr = new StreamReader(Server.MapPath(emailPath + emailFile)); htmlBody = rdr.ReadToEnd(); rdr.Close(); rdr.Dispose(); #region Populate Lead Email Fields htmlBody = htmlBody.Replace("{agent_name}", Page.User.Identity.Name); htmlBody = htmlBody.Replace("{attempt_on}", " at " + dtNow.ToString("MM/dd/yyyy HH:mm:ss") + " - UTC"); htmlBody = htmlBody.Replace("{refund_type}", RefundType.Value); htmlBody = htmlBody.Replace("{callid}", lblCallID.Text); htmlBody = htmlBody.Replace("{donation_date}", dt.ToString("MM/dd/yyyy HH:mm:ss")); htmlBody = htmlBody.Replace("{donationccinfoid}", lblExternalID.Text); htmlBody = htmlBody.Replace("{refund_status}", rplDecision.Text); htmlBody = htmlBody.Replace("{refund_reason}", refundReason.Text); htmlBody = htmlBody.Replace("{amount_donation}", AmountOriginal.Value); htmlBody = htmlBody.Replace("{amount_refund}", Amount.Text); htmlBody = htmlBody.Replace("{first_name}", FirstName.Text); htmlBody = htmlBody.Replace("{last_name}", LastName.Text); htmlBody = htmlBody.Replace("{card_num}", CardNumber.Text); htmlBody = htmlBody.Replace("{refund_message}", msgRefund); #endregion Populate Lead Email Fields #region Populate Standard Email Fields htmlBody = htmlBody.Replace("{script_time}", dtNow.ToString()); if (DateTime.Now.IsDaylightSavingTime()) { htmlBody = htmlBody.Replace("{script_timezone}", String.Format("GMT {0} {1}", tzOffSet, "Eastern Daylight Time")); } else { htmlBody = htmlBody.Replace("{script_timezone}", String.Format("GMT {0} {1}", tzOffSet, "Eastern Standard Time")); } #endregion Populate Standard Email Fields email.SetHtmlBody(htmlBody); if (Connection.GetConnectionType() == "Local") { email.AddTo("Pehuen Test 1", "*****@*****.**"); email.AddTo("Carrie Stevenson", "*****@*****.**"); } else { email.AddTo("Pehuen ARC", "*****@*****.**"); email.AddTo("Carrie Stevenson", "*****@*****.**"); //email.AddCC("MIS", "*****@*****.**"); //email.AddBcc("Pehuen Scripts", "*****@*****.**"); } email.BounceAddress = "*****@*****.**"; email.FromName = "ARC Portal"; email.FromAddress = "*****@*****.**"; email.ReplyTo = "*****@*****.**"; bool success; success = mailman.SendEmail(email); if (success) { // Update the action return(true); } else { // Do not update the action, the system will pick it up again return(false); } } #endregion Chilkat Email } #endregion Chilkat MailMan }