Home » Android » Adding the Body in the Email in Android

Adding the Body in the Email in Android

Posted by: admin June 15, 2020 Leave a comment

Questions:

I had developed the email sending functionality in my Application where I need to send the email with the specified subject. I have done that but I need that as soon as I click the Email Icon It sets some particular piece of Information in the Body part of the email format. It could be any information that I have with me.

Is it possible to set the data in the Email Body in android, I don’t want to write anything in the Body of the mail.

Thanks,
DavidBrown

How to&Answers:
final Intent emailIntent = new Intent( android.content.Intent.ACTION_SEND);

  emailIntent.setType("plain/text");

  emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,
          new String[] { "[email protected]" });

  emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,
          "Email Subject");

  emailIntent.putExtra(android.content.Intent.EXTRA_TEXT,
          "Email Body");

  startActivity(Intent.createChooser(
          emailIntent, "Send mail..."));

Intent.EXTRA_TEXT is what you are looking for.

Answer:

Not very clear what exactly you want. But if you need to add text/data in email body use

intent.putExtra(Intent.EXTRA_TEXT, “This data will appear in email body”);

Answer:

This can be useful for you..

Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("text/plain");
emailIntent.putExtra(Intent.EXTRA_EMAIL,new String[]{"[email protected]"});
emailIntent.putExtra(Intent.EXTRA_CC, new String[]{""});
emailIntent.putExtra(Intent.EXTRA_BCC, new String[]{""});
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Subject of email");
emailIntent.putExtra(Intent.EXTRA_TEXT, "This is test app");
startActivity(emailIntent); 

Answer:

Try this

intent.putExtra(Intent.EXTRA_TEXT   , 
                "body of email -- add text what you want ");