After reading this question and this question I wrote this code to send an email for multiple addresses:
String[] addresses = {"[email protected]", "[email protected]" ,"[email protected]"};
Intent someIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts(
"mailto", Arrays.toString(addresses), null)) //all the addresses
.putExtra(Intent.EXTRA_SUBJECT, "This is a test")
.putExtra(Intent.EXTRA_TEXT, "For my app");
startActivity(Intent.createChooser(someIntent, "Send email..."));
It looks like this:
As you can see in the image for some reason I am getting extra [
for the first email address and extra ]
for the last email address (this is causing non-valid email addresses and I can`t send the email).
Why this is happening and how can I remove those extra [
and ]
.