ActivityNotFoundException while sending email from the application

前端 未结 3 1693
臣服心动
臣服心动 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:35

    Seem problem with android.content which you passing with your putExtras .

    try something like below:

    public Intent sendMail1() {
            Intent messageIntent = new Intent(Intent.ACTION_SEND);
    
            String aEmailList[] = { "rakesh@rocketmail.com" };
            messageIntent.putExtra(Intent.EXTRA_EMAIL, aEmailList);
    
            messageIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
    
            messageIntent.setType("text/html");
            messageIntent.putExtra(Intent.EXTRA_TEXT,
                    Html.fromHtml(body.toString()));
    
            return messageIntent;
        }
    

    Fire your intent like:

    startActivity(Intent.createChooser(sendMail1(), "send mail"));
    

提交回复
热议问题