title: How to send static html as an email content in c#?
body: <p>I am sending an static html with some dynamic content to user email id using c# and JQuery.
  Below is the JavaScriot file from where I am calling th method SendEmail.</p>
  
  <p>$(".EmailInvoice").click(function () {</p>
  
  <pre><code>    $.ajax({
          type: 'POST',
          url: siteUrl + '/invoiceEmail.asmx/SendEmail',
          data: JSON.stringify({  }),
          contentType: "application/json; charset=utf-8",
          dataType: "json",
          async: true,
          success: function (data, status) {              
  
          },
          failure: function (data) {
  
          },
          error: function () {
              alert("error");
          }
      });
  </code></pre>
  
  <p>Below is the invoiceEmail.asmx file</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Configuration;
  using System.IO;
  using System.Linq;
  using System.Web;
  
  using System.Net.Mail;
  using System.Web.Services;
  using System.Web.Hosting;
  
  namespace meltwish
  {
      /// &lt;summary&gt;
  /// Summary description for invoiceEmail
  /// &lt;/summary&gt;
  [WebService(Namespace = "http://tempuri.org/")]
  [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
  [System.ComponentModel.ToolboxItem(false)]
  // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
   [System.Web.Script.Services.ScriptService]
  public class invoiceEmail : System.Web.Services.WebService
  {
  
  
      public static string PopulateBody(string userName, string title, string url, string description)
      {
          string body = string.Empty;
          using (StreamReader reader = new StreamReader(HostingEnvironment.MapPath("~/EmailTemplate.html")))
          {
              body = reader.ReadToEnd();
          }
          body = body.Replace("{UserName}", userName);
          body = body.Replace("{Title}", title);
          body = body.Replace("{Url}", url);
          body = body.Replace("{Description}", description);
          return body;
      }
  
      public static void SendHtmlFormattedEmail(string recepientEmail, string subject, string body)
      {
          MailMessage mailMessage = new MailMessage();
          mailMessage.From = new MailAddress(ConfigurationManager.AppSettings["username"]);
          mailMessage.Subject = subject;
          mailMessage.Body = body;
          mailMessage.IsBodyHtml = true;
          mailMessage.To.Add(new MailAddress(recepientEmail));
          SmtpClient smtp = new SmtpClient();
          smtp.Host = ConfigurationManager.AppSettings["Host"];
          smtp.EnableSsl = Convert.ToBoolean(ConfigurationManager.AppSettings["EnableSsl"]);
          System.Net.NetworkCredential NetworkCred = new System.Net.NetworkCredential();
          NetworkCred.UserName = ConfigurationManager.AppSettings["UserName"];
          NetworkCred.Password = ConfigurationManager.AppSettings["Password"];
          smtp.UseDefaultCredentials = true;
          smtp.Credentials = NetworkCred;
          smtp.Port = int.Parse(ConfigurationManager.AppSettings["Port"]);
          smtp.Send(mailMessage);
      }
  
      //object sender, EventArgs e
     [WebMethod]
      public static string SendEmail()
      {
  
           //string body = this.PopulateBody("John",
          string body = PopulateBody("John",
              "Fetch multiple values as Key Value pair in ASP.Net AJAX AutoCompleteExtender",
              "http://www.aspsnippets.com/Articles/Fetch-multiple-values-as-Key-Value-pair-" +
              "in-ASP.Net-AJAX-AutoCompleteExtender.aspx",
              "Here Mudassar Ahmed Khan has explained how to fetch multiple column values i.e." +
              " ID and Text values in the ASP.Net AJAX Control Toolkit AutocompleteExtender"
              + "and also how to fetch the select text and value server side on postback");
          SendHtmlFormattedEmail("wajedkh@gmail.com", "New article published!", body);
          //this.SendHtmlFormattedEmail("wajedkh@gmail.com", "New article published!", body);
          return "sajjad";
      }
  
  
  }
  }
  </code></pre>
  
  <p>This is the HTMl file that is added to the project. The name is EmailTemplate.html
          
                 </p>
  
  <pre><code>    &lt;meta charset="utf-8" /&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1" /&gt;
  
      &lt;link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" /&gt;
      &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"&gt;&lt;/script&gt;
      &lt;script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"&gt;&lt;/script&gt;
  
  
     &lt;!-- Server CDN Files -- Start --&gt;
      &lt;!--&lt;link class="temp" href="http://klcdn.meltwish.com/styles/store/1.0.2/store.css" rel="stylesheet" /&gt;--&gt;
      &lt;link href="http://localhost:60339/styles/store/1.0.2/store.css" rel="stylesheet" /&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
     &lt;img src = "http://www.aspsnippets.com/images/Blue/Logo.png" /&gt;&lt;br /&gt;&lt;br /&gt;
  &lt;div style = "border-top:3px solid #22BCE5"&gt;&amp;nbsp;&lt;/div&gt;
  &lt;span style = "font-family:Arial;font-size:10pt"&gt;
  Hello &lt;b&gt;{UserName}&lt;/b&gt;,&lt;br /&gt;&lt;br /&gt;
  A new article has been published on ASPSnippets.&lt;br /&gt;&lt;br /&gt;
  &lt;a style = "color:#22BCE5" href = "{Url}"&gt;{Title}&lt;/a&gt;&lt;br /&gt;
  {Description}
  &lt;br /&gt;&lt;br /&gt;
  Thanks&lt;br /&gt;
  ASPSnippets
  &lt;/span&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>This i have added in the Web.Config file.</p>
  
  <pre><code>&lt;appSettings&gt;
        &lt;add key="Host" value="smtp.gmail.com"/&gt;
        &lt;add key="EnableSsl" value="true"/&gt;
        &lt;add key="UserName" value="hussainsajjad9991@gmail.com"/&gt;
       &lt;add key="Password" value="xxxxx"/&gt;
        &lt;add key="Port" value="587"/&gt;
  &lt;/appSettings&gt;
  </code></pre>
  
  <p>Actually whenever I have trying to call the javascript ajax method it is going to the error content. </p>
  
  <p>Help me....</p>