android Send a email
发送纯文本邮件
添加附件
添加多个附件
Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
intent.setType(“text/plain”);
intent.putExtra(Intent.EXTRA_SUBJECT, “Test multiple attachments”);
intent.putExtra(Intent.EXTRA_TEXT, “Mail with multiple attachments”);
intent.putExtra(Intent.EXTRA_EMAIL, new String[]{recipient_address});
ArrayList uris = new ArrayList();
uris.add(Uri.fromFile(new File("/path/to/first/file")));
uris.add(Uri.fromFile(new File("/path/to/second/file")));
intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
附件有多种格式,mime type 设置为:multipart/mixed
给用户弹出选择列表,使用哪个客户端去Send:
startActivity(Intent.createChooser(intent, “Send mail”));