开发者

setting the sender of an email using startActivity(mailIntent)

I send in my android app emails using this code:

  Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
            emailIntent.setType("plain/text");
            emailIntent.putExtra(android.content.I开发者_高级运维ntent.EXTRA_EMAIL, new String[]{"recipient"+"@email.com"});
            emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject");
            emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Text");
            startActivity(Intent.createChooser(emailIntent, "Send mail..."));

but the mail program uses the wrong mail account. Now I try to select the senders email address/mail account. Is there something like:

    emailIntent.putExtra(android.content.Intent.EXTRA_SENDERS_MAIL_ADDRESS, "My_email_address@email.com");

or

    emailIntent.putExtra(android.content.Intent.EXTRA_USERS_EMAIL_ACCOUNT, "mail_account_x");

?


No there is nothing like what you mentioned above. By default it would choose the default email id used to activate the phone as the sender. However user can then change it to other accounts if they are added onto the phone as well.


I have configured two email id.But it doesn't allow me to edit sender id.


If you think about it logically, being able to set the sender email address would allow impersonation, so I'd think that's the reason why you can't set the sender. By default, the user's device will select their default email address

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜