title: mailto link encoding in MVC Razor
body: <p>I have the following model </p>
  
  <pre><code>public class EmailLinkModel
  {
      public string mailbody { get; set; }
      public string emailSubject { get; set; }
      public string emailto { get; set; }        
  }
  </code></pre>
  
  <p>mailbody contains the actual text which is a part of mail body. This text contains a long text [ contains special characters like ? &lt; etc and can contain line breaks spaces etc]
  I want to create a mailto html tag in the partial view and i tried 3 different approaches and  at some point my mailto link not opening the default mail client 
  I think the reason was Html or Url ecnoding [ I am showing the mailbody content in a text area as well here to make sure value is coming correctly]
  Here is my view</p>
  
  <pre><code>@model RoyaltyDb.Models.EmailLinkModel
  @{
      Layout = null;
  }
  &lt;div class="row "&gt;
      @{
          var formatted_doc_data = Model.mailbody;
          /*
          var formatted_doc_data =HttpUtility.HtmlEncode(Model.mailbody);
            */
  
        /*  var formatted_doc_data = Model.mailbody.ToString().Trim().Replace("\n", "%0D%0A");
          formatted_doc_data = formatted_doc_data.ToString().Trim().Replace(" ", "%20");
          formatted_doc_data = formatted_doc_data.ToString().Trim().Replace(" ", "%20");
          formatted_doc_data = formatted_doc_data.ToString().Trim().Replace("%", "%25");
          formatted_doc_data = formatted_doc_data.ToString().Trim().Replace("?", "%3F");
          formatted_doc_data = formatted_doc_data.ToString().Trim().Replace("/", "%2F");
          formatted_doc_data = formatted_doc_data.ToString().Trim().Replace(":", "%3A");*/
      }
      &lt;a class="btn btn-primary center" href="mailto:@Model.emailto?Subject=@Model.emailSubject&amp;body=@formatted_doc_data" target="_top"&gt;Send Mail&lt;/a&gt;
  &lt;/div&gt;
  &lt;hr/&gt;
  &lt;div class="row"&gt;
      @Html.TextAreaFor(m =&gt; m.mailbody, new { style = "width: 100%; height:200px;margin:5px 5px;" })
  &lt;/div&gt;
  </code></pre>
  
  <p>How can i do proper encoding to create the mailto Link</p>