title: Android Intent for sending email with attachment
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/6072895/email-from-internal-storage">Email from internal storage</a>  </p>
  </blockquote>
  
  
  
  <p>The email is being received on by the recipient, but without the attachment.
  Here is the code, any expert knows where did I go wrong?</p>
  
  <pre><code>Intent intent = new Intent(Intent.ACTION_SEND);
  intent.setType("text/plain");
  intent.putExtra(Intent.EXTRA_EMAIL, new String[] {"email@example.com"});
  intent.putExtra(Intent.EXTRA_SUBJECT, "subject here");
  intent.putExtra(Intent.EXTRA_TEXT, "body text");
  File root = Environment.getExternalStorageDirectory();
  File file = new File(root, xmlFilename);
  if (!file.exists() || !file.canRead()) {
      Toast.makeText(this, "Attachment Error", Toast.LENGTH_SHORT).show();
      finish();
      return;
  }
  Uri uri = Uri.parse("file://" + file);
  intent.putExtra(Intent.EXTRA_STREAM, uri);
  startActivity(Intent.createChooser(intent, "Send email..."));
  </code></pre>
  
  <p>I am not getting any toast message.
  Thanks.</p>