ActivityNotFoundException while sending email from the application

前端 未结 3 1672
臣服心动
臣服心动 2021-01-11 12:15

I have written a code in which I am allowing user to send order via email to vendor [ShopOwner] along with their personal and cart item details, but here I am getti

3条回答
  •  迷失自我
    2021-01-11 12:39

    Rakesh sorry for late reply, since 10 am i was trying to resolve your issue and i have tried several times and finally below code has worked:

    i knew you got answer, but i have given many hours for my satisfaction i am placing my answer here, and brother i don't need points for this, because @SahilMahajanMj deserve this:

      Intent i = new Intent(Intent.ACTION_SEND);
            i.putExtra(Intent.EXTRA_EMAIL  , new String[]{"rakesh@rocketmail.com"});
            i.putExtra(Intent.EXTRA_SUBJECT, subject);
            i.setType("message/rfc822");
            i.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(body.toString()));
    
            try {
                startActivity(Intent.createChooser(i, "Send email via :"));
                } catch (android.content.ActivityNotFoundException ex) {
                Toast.makeText(ArrowsActivity.this, "There are no email applications installed.", Toast.LENGTH_SHORT).show();
            }
    

提交回复
热议问题