title: System.Net.Mail creating invalid emails and eml files? Inserting extra dots in host names
body: <p>It appears that .NET's SmtpClient is creating emails with an extra dot in host names if the dot was to appear at the beginning of a MIME encoded line (e.g. test.com sometimes shows up as test..com).  Example code:</p>
  
  <pre><code>[TestMethod]
  public void TestEmailIssue()
  {
      var mail = new System.Net.Mail.MailMessage();
      var smtpClient = new System.Net.Mail.SmtpClient();
  
      mail.To.Add("Test@test.com");
      mail.Subject = "Test";
      mail.From = new System.Net.Mail.MailAddress("test@test.com");
      mail.Body = "Hello this is  a short test of the issue:"
               +" &lt;a href='https://test.com/'&gt;https://test.com/&lt;/a&gt;: ";
  
      smtpClient.PickupDirectoryLocation = "C:\\temp\\";
      smtpClient.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.SpecifiedPickupDirectory;
      smtpClient.Send(mail);
  }
  </code></pre>
  
  <p>This creates an .eml file that looks like this:</p>
  
  <blockquote>
    <p>X-Sender: test@test.com</p>
    
    <p>X-Receiver: Test@test.com</p>
    
    <p>MIME-Version: 1.0</p>
    
    <p>From: test@test.com</p>
    
    <p>To: Test@test.com</p>
    
    <p>Date: 6 Jul 2011 15:55:28 -0400</p>
    
    <p>Subject: Test</p>
    
    <p>Content-Type: text/plain; charset=us-ascii</p>
    
    <p>Content-Transfer-Encoding: quoted-printable</p>
    
    <p>Hello this is  a short test of the issue: https://test=</p>
    
    <p>..com/'><a href="https://test.com/" rel="noreferrer">https://test.com/</a>:=20</p>
  </blockquote>
  
  <p>When sending the file, or opening in Outlook (or any other program), the double dots show up (i.e. test..com).  Note that if I remove the extra space (in "is  a"), that test.com shows correctly since the dot no longer appears at the beginning of the line.</p>
  
  <p>This causes a problem when trying to send website addresses, and we get calls from clients saying this they cannot click our links.  </p>
  
  <p>Has anyone else experienced this?  How can we resolve this issue other than writing our own encoding?</p>