Send Email Intent

前端 未结 30 3262
忘掉有多难
忘掉有多难 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 08:01

    Please use the below code :

                    try {
    
                        String uriText =
                                "mailto:emailid" +
                                        "?subject=" + Uri.encode("Feedback for app") +
                                        "&body=" + Uri.encode(deviceInfo);
                        Uri uri = Uri.parse(uriText);
                        Intent emailIntent = new Intent(Intent.ACTION_SENDTO);
                        emailIntent.setData(uri);
                        startActivity(Intent.createChooser(emailIntent, "Send email using..."));
                    } catch (android.content.ActivityNotFoundException ex) {
                        Toast.makeText(ContactUsActivity.this, "No email clients installed.", Toast.LENGTH_SHORT).show();
                    }
    

提交回复
热议问题