- // 给someone@domain.com发邮件
- Uri uri = Uri.parse("mailto:someone@domain.com");
- Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
- startActivity(intent);
- // 给someone@domain.com发邮件发送内容为“Hello”的邮件
- Intent intent = new Intent(Intent.ACTION_SEND);
- intent.putExtra(Intent.EXTRA_EMAIL, "someone@domain.com");
- intent.putExtra(Intent.EXTRA_SUBJECT, "Subject");
- intent.putExtra(Intent.EXTRA_TEXT, "Hello");
- intent.setType("text/plain");
- startActivity(intent);
- // 给多人发邮件
- Intent intent=new Intent(Intent.ACTION_SEND);
- String[] tos = {"1@abc.com", "2@abc.com"}; // 收件人
- String[] ccs = {"3@abc.com", "4@abc.com"}; // 抄送
- String[] bccs = {"5@abc.com", "6@abc.com"}; // 密送
- intent.putExtra(Intent.EXTRA_EMAIL, tos);
- intent.putExtra(Intent.EXTRA_CC, ccs);
- intent.putExtra(Intent.EXTRA_BCC, bccs);
- intent.putExtra(Intent.EXTRA_SUBJECT, "Subject");
- intent.putExtra(Intent.EXTRA_TEXT, "Hello");
- intent.setType("message/rfc822");
- startActivity(intent);
复制代码 |
|