title: Android send mail with attachment from string
body: <p>I have a HTML string which I want to attach to mail as a file. I could save this string to a file and attach it but I want to do it without saving it to a file. I think it should be possible but I don't know how to do it. This is my code:</p>
  
  <pre><code>String html = "&lt;html&gt;&lt;body&gt;&lt;b&gt;&lt;bold&lt;/b&gt;&lt;u&gt;underline&lt;/u&gt;&lt;/body&gt;&lt;/html&gt;";
  Intent intent = new Intent(Intent.ACTION_SEND, Uri.parse("mailto:"));
  intent.setType("text/html");
  intent.putExtra(Intent.EXTRA_SUBJECT, "Subject");
  intent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(html));
  
  // this is where I want to create attachment
  intent.putExtra(Intent.EXTRA_STREAM, Html.fromHtml(html));
  
  startActivity(Intent.createChooser(intent, "Send Email"));
  </code></pre>
  
  <p>How can I attach string as a file to mail?</p>