I am making an email sending application on Android. Only To field is visible when I launch my application through a button click.
Why doesn’t it show Cc, Bcc and Subject fields? How to add these fields to my app? And how to show a default email address in the To field? (Now nothing is written in the To field by default.)
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
clickBtn = (Button) findViewById(R.id.sendemail);
clickBtn.setText("Send email");
clickBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
String aEmailList[] = { "[email protected]","[email protected]" };
String aEmailCCList[] = { "[email protected]","[email protected]"};
String aEmailBCCList[] = { "[email protected]" };
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, aEmailList);
emailIntent.putExtra(android.content.Intent.EXTRA_CC, aEmailCCList);
emailIntent.putExtra(android.content.Intent.EXTRA_BCC, aEmailBCCList);
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "My subject");
emailIntent.setType("text/plain");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "My message body.");
startActivity(emailIntent);
//startActivity(Intent.createChooser(emailIntent, "Send mail..."));
finish();
}
});
Hit "Compose" to begin a new email, or click on the email thread that you want to reply to and select "Reply" to write a response. 3. If you're typing a new message, the "CC" option will appear to the right of the "To" field. Click "CC" to open up the CC field, and type in the recipient's email address.
Cc means carbon copy and Bcc means blind carbon copy. For emailing, you use Cc when you want to copy others publicly, and Bcc when you want to do it privately. Any recipients on the Bcc line of an email are not visible to others on the email.
intent.putExtra(Intent.EXTRA_CC, new String[] { "[email protected]" });
You just had to make the second parameter a string array
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With