2011-10-07 50 views
3

如何在電子郵件中發送多個圖像? 我非常喜歡將圖像放在電子郵件的正文中,而不是附加在電子郵件的正文中。如何將SD卡中的多個圖像附加到電子郵件?

我已經運行此代碼,但不起作用。

+1

哪裏是* 「這個代碼」 *?它的問題到底是什麼? – 2011-10-07 10:22:29

+0

看看:http://stackoverflow.com/questions/5074619/send-e-mail-in-html-format –

回答

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:")); 

享受代碼...

相關問題