title: MimeKit subject encoding and Cyrillic alphabet
body: <p>I'm using MimeKit to build email body string then pass it to pmta along with list of receivers + placeholders for every receiver, then pmta takes care of merging them. We're missing placeholders in subject when the subject also contains cyrillic characters.</p>
  <p>Placeholders are expressed as strings in square brackets, i.e <code>[firstname]</code></p>
  <p>Sample subject with two tokens and few characters in between:</p>
  <pre><code>subject = &quot;Message for [firstname] Агф [firstname]&quot;;
  </code></pre>
  <p>generates the following string (note the second placeholder, missing because of encoding):</p>
  <pre><code>From: ...
  Date: ...
  Subject: Message for [firstname]
   =?utf-8?b?0JDQs9Cw0YTQvtC90L7QsiDQhtC70LvRjyBbZmlyc3RuYW1lXSDQhtC70LvRjw==?=
  </code></pre>
  <p>This is how I'm building the message:</p>
  <pre><code>Encoding useEncoding = Encoding.UTF8;
  
  subject = subject.Replace(&quot;\u00A0&quot;, &quot; &quot;); // replace nbsp with normal space in case one copied by mistake
  
  var message = new MimeMessage() { Subject = subject };
  
  var bodyText = StripHtmlBody(body);
  
  var textPart = new TextPart(MimeKit.Text.TextFormat.Plain)
  {
      ContentTransferEncoding = ContentEncoding.QuotedPrintable
  };
  textPart.SetText(useEncoding, bodyText);
  
  
  var htmlPart = new TextPart(MimeKit.Text.TextFormat.Html)
  {
      ContentTransferEncoding = ContentEncoding.QuotedPrintable
  };
  htmlPart.SetText(useEncoding, body);
  
  
  var multipartAlternative = new MultipartAlternative()
  {
      textPart,
      htmlPart
  };
  
  message.Body = multipartAlternative;
  
  foreach (var item in headers)
      message.Headers.Add(item.HeaderId, item.HeaderValue);
  
  var tokenMailbox = MailboxAddress.Parse(&quot;non-existing-email@domain.com&quot;);
  message.To.Add(tokenMailbox);
  message.Prepare(EncodingConstraint.EightBit, 998);
  
  var messageString = &quot;&quot;;
  using (var ms = new MemoryStream())
  {
      message.WriteTo(ms);
      messageString = useEncoding.GetString(ms.ToArray());
  }
  
  messageString = messageString.Replace(tokenMailbox.ToString(), &quot;[ReceiverMailbox]&quot;);
  
  // inject in pmta and return...
  
  </code></pre>
  <p>Message body (text &amp; html) is persisted okay, tokens are there after encryption and everything works as expected, my issue with this is at the subject part.</p>
  <p>Is there any advice on how can I overcome this situation where certain tokens/placeholders would be spared by encoding?</p>
  <p>Any help is appreciated.</p>