用 Android Intent 发邮件

三句话小结

  1. Intent.ACTION_SENDTO 多在发纯文本邮件时用
  2. Intent.ACTION_SEND 邮件附件可带可不带
  3. Intent.ACTION_SEND_MULTIPLE 发送多附件时用

参考文档

Intent
Android 之调用系统 Email 发送邮件

代码看上去是这个样子

Intent email = new Intent(Intent.ACTION_SEND);
email.setType("message/rfc822");
email.putExtra(Intent.EXTRA_EMAIL, new String[] {"[email protected]"});
email.putExtra(Intent.EXTRA_SUBJECT, "Hi, This is a test mail..");  
email.putExtra(Intent.EXTRA_TEXT   , "Did you get this mail? if so please reply back");
startActivity(Intent.createChooser(email, "Choose an Email Client"));

你可能感兴趣的:(用 Android Intent 发邮件)