title: Can MFMailComposeViewController attach an XML doc to an HTML message?
body: <p>I am creating an email in MFMaiilComposeViewController and if I simply create some html snippets and assign them to the message body - all is well. The resulting email (in GMail and Yahoo) looks like the original HTML I sent.</p>
  
  <pre><code> [mailMan_ setMessageBody:body isHTML:YES];
  </code></pre>
  
  <p>On the other hand, if I also include an XML attachment, my email reader renders <em>everything</em> as plain text &hellip; including, the XML inlined. IE: my mail client (GMail, Yahoo) shows the raw HTHML and XML tags - including html tags that I didn't supply - ie: the html, head, body tags the iPhone provides around the content:</p>
  
  <pre><code> NSData *opmlData = [[NSData alloc] initWithData:[opml dataUsingEncoding:NSUTF8StringEncoding]];
   NSString *fileName = [NSString stringWithFormat:@"%f.opml", [NSDate timeIntervalSinceReferenceDate]];
   [mailMan_ addAttachmentData:opmlData mimeType:@"text/xml" fileName:fileName];
  </code></pre>
  
  <p>I pop3'd the mails to see what was happening and found that <em>WITHOUT</em> an attachment, the resulting html section of the email contains this block:</p>
  
  <pre><code>--0-1682099714-1273329398=:59784
  Content-Type: text/html; charset=us-ascii
  
  &lt;html&gt;&lt;body bgcolor="#FFFFFF"&gt;&lt;div&gt;&lt;h2 style="b
  </code></pre>
  
  <p>while on the other hand, <em>WITH</em> the XML attachment, the iPhone is sending this:</p>
  
  <pre><code>--0-881105825-1273328091=:50337
  Content-Type: text/plain; charset=us-ascii
  
  &lt;html&gt;&lt;body bgcolor="#FFFFFF"&gt;&lt;div&gt;&lt;h2 style="bac
  </code></pre>
  
  <p>Notice the difference? Look at the Content-Type &hellip; text/<strong>html</strong> vs text/<strong>plain</strong>. It looks like when I include an XML attachment, the iPhone is errantly tagging the HTML version of the body as plain text! Just to clarify, technically, both with and without the attachment, the iPhone also includes this:</p>
  
  <pre><code>--0-881105825-1273328091=:50337
  Content-Type: text/plain; charset=us-ascii
  
  Notebook
  Carpentry
  Bathroom floor tile
  Bathroom wall tile
  Scrape thinset
  </code></pre>
  
  <p>But this obviously isn't where the problem lies.</p>
  
  <p>Am I doing something wrong? What must I do to actually "attach" XML without the iPhone labeling the entire HTML body as plain text. I tried reversing the assignments (attachment first and then body) but no luck.</p>
  
  <p>For what it's worth, the email looks perfect from the iPhone's sending interface. Indeed, the HTML renders correctly and the attachment looks like a little icon at the bottom of the message. This problem has more to do with what the iPhone is actually sending.</p>