How can I set the default email adress for the from field in Gmail Composer

梦想与她 提交于 2019-12-11 20:26:00

问题


While starting the Gmail Composer com.google.android.gm.ComposeActivity in my App, I can use the intent parameter EXTRA_EMAIL set the to email adress. Is there anyway that can set the default from email address for ComposeActivity if I have more than one Gmail account on my device?

    Intent sendIntent = new Intent(android.content.Intent.ACTION_SEND);
    sendIntent.setType("plain/text");
    sendIntent.putExtra(Intent.EXTRA_TEXT, body);
    sendIntent.putExtra(Intent.EXTRA_EMAIL, cc@gmail.com);
    sendIntent.putExtra(Intent.EXTRA_BCC, "bcc@gmail.com");
    sendIntent.putExtra(Intent.EXTRA_CC, "cc@gmail.com");
    sendIntent.putExtra(Intent.?????, "from@gmail.com"); //Can we set the from email?
    sendIntent.setPackage("com.google.android.gm");
    startActivity(sendIntent); 

Thanks.


回答1:


try this

emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, aEmailList);

and aEmailList is String aEmailList[] = { "user@host.com","user2@host.com" };

Hope this will help you.



来源:https://stackoverflow.com/questions/5216322/how-can-i-set-the-default-email-adress-for-the-from-field-in-gmail-composer

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!