//********************************************************** // CoWorker profile wall post //********************************************************** public void CoWorkerWallPostEmail(string wallWriterUserName, Guid wallOwnerUserId, long streamId, string wallMessage) { string customApplicationUrl = GetCustomApplicationUrl(true, true, true, ""); string wallOwnerFirstName = UserHelpers.GetFirstName(wallOwnerUserId); string wallWriterFirstName = UserHelpers.GetFirstName(wallWriterUserName); string wallOwnerEmailAddress = UserHelpers.GetUserEmailAddress(wallOwnerUserId); string emailMsg = ReadTemplateFile("~/Content/Templates/WallPost.htm"); emailMsg = emailMsg.Replace("{WallOwnerFirstName}", wallOwnerFirstName); emailMsg = emailMsg.Replace("{WallWriterFirstName}", wallWriterFirstName); emailMsg = emailMsg.Replace("{WallMessage}", wallMessage); emailMsg = emailMsg.Replace("{StreamId}", streamId.ToString()); emailMsg = emailMsg.Replace("{ApplicationUrl}", customApplicationUrl); //emailMsg = emailMsg.Replace("{CoWorkerId}", coWorkerId.ToString()); MailMessage message = new MailMessage(); message.From = new MailAddress(NotificationEmailAddressFrom, "Make progress every day"); message.To.Add(wallOwnerEmailAddress); message.Subject = "Wallpost notification"; message.Body = emailMsg; message.BodyEncoding = Encoding.UTF8; message.IsBodyHtml = true; SendEmail(message); }
public void TicketCommentReplyEmail(Ticket ticket, TicketComment ticketCommentReply) { string applicationUrl = GetCustomApplicationUrl(true, true, true, ""); string ticketUrl = GetCustomApplicationUrl(true, true, true, "/Projects/Ticket/Details/" + ticket.TicketId + ticket.TicketId + "?cid=" + ticketCommentReply.TicketCommentId + "#" + ticketCommentReply.TicketCommentId); string emailMsg = ReadTemplateFile("~/Content/Templates/TicketComment.htm"); emailMsg = emailMsg.Replace("{TicketSubject}", ticket.TicketSubject); emailMsg = emailMsg.Replace("{TicketId}", ticket.TicketId.ToString()); emailMsg = emailMsg.Replace("{TicketCommentDetails}", ticketCommentReply.TicketCommentDetails); emailMsg = emailMsg.Replace("{FirstName}", UserHelpers.GetFirstName(ticketCommentReply.TicketCommentSubmitterUserId)); emailMsg = emailMsg.Replace("{ApplicationUrl}", applicationUrl); emailMsg = emailMsg.Replace("{TicketUrl}", ticketUrl); MailMessage message = new MailMessage(); message.From = new MailAddress(NotificationEmailAddressFrom, "Make progress every day"); // obtain the ticket creator email address string ticketCreatorEmailAddress = UserHelpers.GetUserEmailAddress(ticket.TicketCreatorUserId); message.To.Add(ticketCreatorEmailAddress); // parse the TicketOwnersEmailList and add them to the email message TO field if (!string.IsNullOrEmpty(ticket.TicketOwnersEmailList)) { string[] toEmailAddresses = ticket.TicketOwnersEmailList.Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); foreach (string toEmail in toEmailAddresses) { message.To.Add(toEmail); } } // parse the TicketEmailNotificationList and add any record to the CC field of the email if (!string.IsNullOrEmpty(ticket.TicketEmailNotificationList)) { string[] ccEmailAddresses = ticket.TicketEmailNotificationList.Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); foreach (string ccEmail in ccEmailAddresses) { message.CC.Add(ccEmail); } } message.Subject = "#" + ticket.TicketId + " - " + ticket.TicketSubject; message.Body = emailMsg; message.BodyEncoding = Encoding.UTF8; message.IsBodyHtml = true; SendEmail(message); }
public void StatusPostComment(string currentUserUserName, long streamId, string statusCommentMessage) { // Below we // 1. Notify the stream creator of the comment // 2. Notify those that have commented already on the stream (exclude the current comment submitter) //Grab the UserId of the stream creator var stream = new StreamRepository().GetStream(streamId); // Get the stream owner firstname & email address string statusOwnerFirstName = UserHelpers.GetFirstName(stream.StreamCreatorUserId); string statusOwnerEmailAddress = UserHelpers.GetUserEmailAddress(stream.StreamCreatorUserId); // Get a list of users who have commented on this status var commentatorsAdresses = new StreamCommentRepository().GetStatusCommentatorsEmailAddresses(streamId); // remove the current user from the list of commentatos since notifiying him would be redundant commentatorsAdresses.Remove(currentUserUserName); //FYI: EmailAddress is reused as the username in this app. string commenterFirstName = UserHelpers.GetFirstName(currentUserUserName); // Compose email string applicationUrl = GetCustomApplicationUrl(true, true, true, ""); string emailMsg = ReadTemplateFile("~/Content/Templates/StatusPostComment.htm"); emailMsg = emailMsg.Replace("{StatusCommenterFirstName}", commenterFirstName); emailMsg = emailMsg.Replace("{StatusMessage}", statusCommentMessage); emailMsg = emailMsg.Replace("{StreamId}", streamId.ToString()); emailMsg = emailMsg.Replace("{ApplicationUrl}", applicationUrl); MailMessage message = new MailMessage(); message.From = new MailAddress(NotificationEmailAddressFrom, "Make progress every day"); foreach (string emailAddress in commentatorsAdresses) { message.To.Add(emailAddress); } message.Subject = commenterFirstName + "- commented on status"; message.Body = emailMsg; message.BodyEncoding = Encoding.UTF8; message.IsBodyHtml = true; SendEmail(message); }