public void ReplyToPolicy(PolicyReplyViewModel model) { string smtpServerAddress = ConfigurationManager.AppSettings["SMTPAddress"]; int smtpPortNumber = Convert.ToInt32(ConfigurationManager.AppSettings["SMTPPortNumber"]); string fromAddress = ConfigurationManager.AppSettings["FromAddress"]; string url = string.Format("{0}/AdsManagement/AdsManagement/ViewAd?policyId={1}", ConfigurationManager.AppSettings["SiteUrl"], model.Policy_Id); string toEmailAddress = model.Policy_Create_EmailAddress; string subject = string.Format("Re: {0}", model.Subject); StringBuilder sb = new StringBuilder(); // Add email heading model.Name = string.IsNullOrEmpty(model.Name) ? "Someone" : model.Name; sb.Append(string.Format("{0} <{1}> has replied to your ad.", model.Name, model.EmailAddress)); sb.Append("<br />"); sb.Append(url); sb.Append("<br />"); sb.Append("<br />"); sb.Append("Here is the text of the reply"); sb.Append("<br />"); sb.Append("<br />"); sb.Append(string.Format("{0}.", model.Message)); sb.Append("<br />"); sb.Append("<br />"); sb.Append("Thank you,"); sb.Append("<br />"); sb.Append("Queads.co.za"); EmailHandler.SendEmail(smtpServerAddress, smtpPortNumber, fromAddress, toEmailAddress, null, subject, sb.ToString()); }
public HttpResponseMessage PolicyReply(PolicyReplyViewModel model) { ServiceHandlers.PolicyHandler.ReplyToPolicy(model); return(Request.CreateResponse <string>(HttpStatusCode.OK, "Reply sent successfully.")); }