public static void WeeklyGeneralNewsLetter() { Sitecore.Diagnostics.Log.Debug("Scheduled Weekly Newsletter Send Starting."); try { string sql = "member_GetNewsletterSubscribers";//stored procedure using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["membership"].ConnectionString)) { conn.Open(); using (SqlCommand cmd = new SqlCommand(sql, conn)) { cmd.Parameters.AddWithValue("@DefaultName", "Parent"); //used as the value the reader should read when the first name is missing, null, etc SqlDataReader reader = cmd.ExecuteReader(); if (reader.HasRows) { string memberName = string.Empty; string emailAddress = string.Empty; int percentComplete = 0; Guid memberId = new Guid(); while (reader.Read()) { emailAddress = reader.GetString(0); memberName = reader.GetString(1); //percentComplete = reader.GetInt16(2); //pulling this out of the sproc to make it more maintainable - nobody else works with stored procedures memberId = reader.GetGuid(3); //get the percent complete percentComplete = PercentProfileComplete(memberId); //send email logic //-- for testing until its wired /*Sitecore.Diagnostics.Log.Debug("General Email Newsletter for " + Environment.NewLine + * "- Email:" + emailAddress + Environment.NewLine + * "- Name:" + memberName + Environment.NewLine + * "- MemberId: " + memberId.ToString() + Environment.NewLine + * "- % Complete " + percentComplete.ToString()); */ Domain.ExactTarget.InvokeE1GeneralNewsLetterRequest newsletterRequest = new Domain.ExactTarget.InvokeE1GeneralNewsLetterRequest(); newsletterRequest.UserName = memberName; newsletterRequest.ToEmail = emailAddress; newsletterRequest.PreferredLanguage = Constants.Language_English_US; // newsletterRequest.RequestUrl = whatsthis newsletterRequest.ProfilePercentCompletePlaceholder = percentComplete.ToString(); // where do i put in the profile percent complete html //bg: this is the actual tag that was in the ET template and needs to be updated. //<img src="img-1.png" style="vertical-align:top;" width="178" height="45" alt="" /> BaseReply mailReply = ExactTargetService.InvokeE1GeneralNewsLetter(newsletterRequest); if (mailReply.Successful == false) { Sitecore.Diagnostics.Log.Debug("Newsletter Send Failed to (" + newsletterRequest.ToEmail + ") Message=" + mailReply.Message); //todo: log this failure so that this row can be rerun later } } } } } } catch (Exception ex) { // throw ex; } Sitecore.Diagnostics.Log.Debug("Scheduled Task ran"); }