private string GetEmailBody(Feedback feedback, string department = "Administrator") { var sb = new StringBuilder(100); var user = UserManager.GetUser(feedback.Username); MailHtml.AddGreetingsToStringBuilder(user, sb); sb.AppendLine("Status:"); sb.AppendLine("<q><strong>"); sb.AppendLine(feedback.GetStatus().Status); sb.AppendLine("</strong></q>"); sb.AppendLine(MailHtml.LineBreak); sb.AppendLine(MailHtml.LineBreak); sb.AppendLine("In response to your:"); sb.AppendLine("<q><strong>"); sb.AppendLine(feedback.Message); sb.AppendLine("</strong></q>"); sb.AppendLine(MailHtml.LineBreak); sb.AppendLine(MailHtml.LineBreak); sb.AppendLine("Our response:"); sb.AppendLine("<q><strong>"); sb.AppendLine(feedback.Response); sb.AppendLine("</strong></q>"); sb.AppendLine(MailHtml.LineBreak); sb.AppendLine(MailHtml.LineBreak); MailHtml.AddContactUsToStringBuilder(sb); sb.AppendLine(MailHtml.LineBreak); sb.AppendLine(MailHtml.LineBreak); MailHtml.AddThanksFooterOnStringBuilder(AppVar.Setting.AdminName, department, sb); var mail = sb.ToString(); sb = null; GC.Collect(); return(mail); }
private void SendEmailToAppDeveloper(ApplicationUser developerUser, AppModerateViewModel model) { var loggedUser = User.GetUser(); var loggedUsername = loggedUser.DisplayName; var sb = new StringBuilder(50); MailHtml.AddGreetingsToStringBuilder(developerUser, sb); sb.AppendLine(MailHtml.LineBreak); sb.AppendLine(model.Message); sb.AppendLine(MailHtml.LineBreak); if (model.LikeToHearFromYou) { sb.AppendLine(MailHtml.LineBreak); sb.AppendLine( MailHtml.GetStrongTag( "Note: ** We would like to hear back from you. Please send your replies to '" + AppVar.Setting.OfficeEmail + "' **")); sb.AppendLine(MailHtml.LineBreak); } sb.AppendLine(MailHtml.LineBreak); sb.AppendLine(); MailHtml.AddThanksFooterOnStringBuilder(loggedUser.DisplayName, "Administrator", sb); var message = sb.ToString(); sb = null; GC.Collect(); var subjectToDeveloper = "A message from admin : " + loggedUsername; var subjectToAdmin = "An email sent to : " + developerUser.Email + " [this mail contains the sample]"; AppVar.Mailer.Send(developerUser.Email, subjectToDeveloper, message); AppVar.Mailer.Send(loggedUser.Email, subjectToAdmin, message); }