我附上一个TEXT文件到电子邮件与代码:
Intent emailIntent = new Intent(Intent.ACTION_SENDTO,Uri.fromParts("mailto","abc@gmail.com",null)); emailIntent.putExtra(Intent.EXTRA_SUBJECT,"Report"); emailIntent.putExtra(Intent.EXTRA_TEXT,prepareBodyMail()); File root = Environment.getExternalStorageDirectory(); File file = new File(root,"/MyFolder/report.txt"); Uri uri = Uri.fromFile(file); emailIntent.putExtra(Intent.EXTRA_STREAM,uri); startActivity(Intent.createChooser(emailIntent,"Pick an Email provider"));
只有身体和主体来临,没有任何附件
我在Inbox Problem将这个问题报告给Google Groups
任何人可以帮助我在代码中缺少什么?
解决方法
尝试这个
Uri myUri = Uri.parse("file://" + path); emailIntent.putExtra(Intent.EXTRA_STREAM,myUri);