title: C# MailMessage to stream - encoding issue
body: <p>Iam using Amazon SES SendRawEmail API hence i need a MailMessage as a Memorystream.</p>
  
  <p>I have found several answers to the MailMessage to MemoryStream issue here on stackoverflow.</p>
  
  <p><strong>Solution 1:</strong> Using the one that uses private methods it results in wrong encoding of parts of the email:
  <a href="https://stackoverflow.com/a/8826833">https://stackoverflow.com/a/8826833</a></p>
  
  <p><strong>Solution 2:</strong> No Encoding problems using this solution where you send to a pickup directory and then read it back in:
  <a href="https://stackoverflow.com/a/14350088">https://stackoverflow.com/a/14350088</a></p>
  
  <p>I very much dislike the fact that i need to write to a temporary file to make this work correctly.
  Does anyone have any idea how the pure MemoryStream solution can mess up some of the encoding.</p>
  
  <p>The mail message iam testing with is this:</p>
  
  <pre><code>var mailMessage = new MailMessage();
  mailMessage.Subject = "HEADER WITH SPECIAL ÆØÅ";
  mailMessage.Body = "TEST";
  
  Attachment att = new Attachment(@"C:\AttachmentWithSpecial ÆØÅ.pdf");
  mailMessage.Attachments.Add(att);
  mailMessage.From = new MailAddress("test@test.com", "NameÆØÅ");
  mailMessage.To.Add(new MailAddress("test@test.com", "NameÆØÅ"));
  </code></pre>
  
  <p><strong>To summarize:</strong></p>
  
  <ul>
  <li>If i send this message with standard SMTP it looks good.</li>
  <li>If i send it using SendRawEmail it looks good if i generated the memorystream by using solution 2</li>
  <li>If i send it using SendRawEmail it has encoding issues if i generated the memorystream by using solution 1.</li>
  </ul>
  
  <p>With encoding issues i mean 'ø' showing up as </p>
  
  <p><img src="https://i.stack.imgur.com/xB8ez.png" alt="enter image description here"></p>