如何在电子邮件中发送多个图像? 我非常希望图像在电子邮件的正文中,而不是附加它。
我已运行此代码但无效。
答案 0 :(得分:6)
其中image_path数组列表用于SD卡的商店图像路径地址
image_path.add(Environment.getExternalStorageDirectory() + "/defaultg1.jpg");
image_path.add(Environment.getExternalStorageDirectory() + "/defaultg2.jpg");
if(image_path.size() > 0 && edt_weight1.getText().length() > 0 && edt_weight2.getText().length() > 0){
ArrayList<Uri> uris = new ArrayList<Uri>();
for(int i=0;i<image_path.size();i++){
File fileIn = new File(image_path.get(i));
Uri u = Uri.fromFile(fileIn);
uris.add(u);
}
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE);
emailIntent.setType("image/jpg");
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Enjoy the photo");
emailIntent.putExtra(Intent.EXTRA_TEXT, "Plz find the attachment.");
emailIntent.putExtra(Intent.EXTRA_STREAM, uris);
startActivity(Intent.createChooser(emailIntent, "Email:"));
享受代码......