Send Email Intent

前端 未结 30 3812
忘掉有多难
忘掉有多难 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:03

    when you will change your intent.setType like below you will get

    intent.setType("text/plain");
    

    Use android.content.Intent.ACTION_SENDTO to get only the list of e-mail clients, with no facebook or other apps. Just the email clients. Ex:

    new Intent(Intent.ACTION_SENDTO);
    

    I wouldn't suggest you get directly to the email app. Let the user choose his favorite email app. Don't constrain him.

    If you use ACTION_SENDTO, putExtra does not work to add subject and text to the intent. Use Uri to add the subject and body text.

    EDIT: We can use message/rfc822 instead of "text/plain" as the MIME type. However, that is not indicating "only offer email clients" -- it indicates "offer anything that supports message/rfc822 data". That could readily include some application that are not email clients.

    message/rfc822 supports MIME Types of .mhtml, .mht, .mime

提交回复
热议问题