我正在尝试发送带有图像作为附件的电子邮件。我看到附件的邮件,而发送,但在收件箱中,我只看到邮件消息,但附件失踪。如果我的代码出错了,请帮助我
ArrayList<String> fetchList= new ArrayList<>();
fetchList= getIntent().getStringArrayListExtra("Uri");
ArrayList<Uri> uriList=new ArrayList<>();
for (int i=0;i<fetchList.size();i++){
uriList.add(i,Uri.parse(fetchList.get(i)));
}
public void sendClicked(View view) {
String emailBody =textMessage.getText().toString();
String emailSubject=textSubject.getText().toString();
String Email_To[]=new String[]{"kittutanu@yahoo.co.in"};
final Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_EMAIL, Email_To);
intent.putExtra(Intent.EXTRA_SUBJECT, emailSubject);
intent.putExtra(Intent.EXTRA_TEXT, emailBody);
if (uriList != null) {
intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uriList);
}
try {
this.startActivity(intent);
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(this, "There are no email clients installed.", Toast.LENGTH_SHORT).show();
}
}
}
您尝试过多部分/替代或多部分/混合类型吗?
下面是一个如何在Android中发送带有文件附件的电子邮件的示例