Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android : how to open a mail composer view?

I just want to know how to open Mail Composer in Android.

With iOS, I would do something like this :

MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init];
[controller setSubject:@"Mail subject"];
[controller setMessageBody:@"Mail body" isHTML:bool];
[controller setToRecipients:recipientsList];
if(controller) [self presentModalViewController:controller animated:YES];

How about Android ?

Thanks a lot.

like image 424
Rob Avatar asked Jul 11 '12 08:07

Rob


1 Answers

Intent intent=new Intent(Intent.ACTION_SEND);
String[] recipients={"[email protected]"};
intent.putExtra(Intent.EXTRA_EMAIL, recipients);
intent.putExtra(Intent.EXTRA_SUBJECT,"abc");
intent.putExtra(Intent.EXTRA_TEXT,"def");
intent.putExtra(Intent.EXTRA_CC,"ghi");
intent.setType("text/html");
startActivity(Intent.createChooser(intent, "Send mail"));
like image 78
AkashG Avatar answered Sep 27 '22 17:09

AkashG