Send Email Intent

前端 未结 30 3284
忘掉有多难
忘掉有多难 2020-11-22 07:27
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType(\"text/html\");
intent.putExtra(Intent.EXTRA_EMAIL, \"emailaddress@emailaddress.com\");
intent.putExtr         


        
30条回答
  •  渐次进展
    2020-11-22 07:57

    None of these solutions were working for me. Here's a minimal solution that works on Lollipop. On my device, only Gmail and the native email apps appear in the resulting chooser list.

    Intent emailIntent = new Intent(Intent.ACTION_SENDTO,
                                    Uri.parse("mailto:" + Uri.encode(address)));
    
    emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
    emailIntent.putExtra(Intent.EXTRA_TEXT, body);
    startActivity(Intent.createChooser(emailIntent, "Send email via..."));
    

提交回复
热议问题