title: MailMessage in HTML with AlternateView in Text not working
body: <p>Can anyone explain why this code is not working:</p>
  
  <pre><code>async Task Main()
  {
      using (var smtpClient = new SmtpClient(@"127.0.0.1", 25))
      {
          smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
          var from = new MailAddress(@"sender@mydomain.com");
          var to = new MailAddress(@"receiver@mydomain.com");
          using (var message = new MailMessage())
          {
              message.Subject = "Email Subject";
              message.Body = "&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;h1&gt;Hello World!&lt;/h1&gt;&lt;/body&gt;&lt;/html&gt;";
              message.IsBodyHtml = true;
              message.From = from;
              message.To.Add(to);
              message.AlternateViews.Add(AlternateView.CreateAlternateViewFromString("Hello World!", null, MediaTypeNames.Text.Plain));
              await smtpClient.SendMailAsync(message);
          }
      }
  }
  </code></pre>
  
  <p>Output message is:</p>
  
  <blockquote>
    <p>MIME-Version: 1.0 From: sender@mydomain.com To: receiver@mydomain.com
    Date: 12 May 2016 14:51:30 +0200 Subject: Email Subject Content-Type:
    multipart/alternative; 
    boundary=--boundary_2_be88a42a-4d48-4096-b4e0-71fb7857809f</p>
    
    <p>----boundary_2_be88a42a-4d48-4096-b4e0-71fb7857809f Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding:
    quoted-printable</p>
    
    <p><h1>Hello World!</h1>
    ----boundary_2_be88a42a-4d48-4096-b4e0-71fb7857809f Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding:
    quoted-printable</p>
    
    <p>Hello World!
    ----boundary_2_be88a42a-4d48-4096-b4e0-71fb7857809f--</p>
  </blockquote>
  
  <p>This code is working:</p>
  
  <pre><code>async Task Main()
  {
      using (var smtpClient = new SmtpClient(@"127.0.0.1", 25))
      {
          smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
          var from = new MailAddress(@"sender@mydomain.com");
          var to = new MailAddress(@"receiver@mydomain.com");
          using (var message = new MailMessage())
          {
              message.Subject = "Email Subject";
              message.Body = "Hello World!";
              message.IsBodyHtml = false;
              message.From = from;
              message.To.Add(to);
              message.AlternateViews.Add(AlternateView.CreateAlternateViewFromString("&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;h1&gt;Hello World!&lt;/h1&gt;&lt;/body&gt;&lt;/html&gt;", null, MediaTypeNames.Text.Html));
              await smtpClient.SendMailAsync(message);
          }
      }
  }
  </code></pre>
  
  <p>Output is fine</p>
  
  <blockquote>
    <p>MIME-Version: 1.0 From: sender@mydomain.com To: receiver@mydomain.com
    Date: 12 May 2016 14:46:52 +0200 Subject: Email Subject Content-Type:
    multipart/alternative; 
    boundary=--boundary_1_2d888597-e405-40cb-8bd4-1bfcba04fb44</p>
    
    <p>----boundary_1_2d888597-e405-40cb-8bd4-1bfcba04fb44 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding:
    quoted-printable</p>
    
    <p>Hello World!
    ----boundary_1_2d888597-e405-40cb-8bd4-1bfcba04fb44 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding:
    quoted-printable</p>
    
    <p><h1>Hello World!</h1>
    ----boundary_1_2d888597-e405</p>
    
    <p>-40cb-8bd4-1bfcba04fb44--</p>
  </blockquote>
  
  <p>And this code is working:</p>
  
  <pre><code>async Task Main()
  {
      using (var smtpClient = new SmtpClient(@"127.0.0.1", 25))
      {
          smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
          var from = new MailAddress(@"sender@mydomain.com");
          var to = new MailAddress(@"receiver@mydomain.com");
          using (var message = new MailMessage())
          {
              message.Subject = "Email Subject";
              message.From = from;
              message.To.Add(to);
              message.AlternateViews.Add(AlternateView.CreateAlternateViewFromString("&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;h1&gt;Hello World!&lt;/h1&gt;&lt;/body&gt;&lt;/html&gt;", null, MediaTypeNames.Text.Html));
              message.AlternateViews.Add(AlternateView.CreateAlternateViewFromString("Hello World!", null, MediaTypeNames.Text.Plain));
              await smtpClient.SendMailAsync(message);
          }
      }
  }
  </code></pre>
  
  <p>Output is fine also:</p>
  
  <blockquote>
    <p>MIME-Version: 1.0 From: sender@mydomain.com To: receiver@mydomain.com
    Date: 12 May 2016 15:07:24 +0200 Subject: Email Subject Content-Type:
    multipart/alternative; 
    boundary=--boundary_3_fa7662d6-404a-4c86-a775-373355aa41e2</p>
    
    <p>----boundary_3_fa7662d6-404a-4c86-a775-373355aa41e2 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding:
    quoted-printable</p>
    
    <p><h1>Hello World!</h1>
    ----boundary_3_fa7662d6-404a-4c86-a775-373355aa41e2 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding:
    quoted-printable</p>
    
    <p>Hello World!
    ----boundary_3_fa7662d6-404a-4c86-a775-373355aa41e2--</p>
  </blockquote>
  
  <p>Edit: can anyone help in having html tags not interpreted in outputs?</p>