I have Exchange ActiveSync setup on my phone and it works as expected. My problem is that when I want to开发者_如何学编程 send an email in code it always uses the Gmail account (which of course I cannot remove) as the sender. It is essential that the account used be the Exchange one as that is the users business email account.
I used the code from Send auto email programmatically
It works fine but uses the Gmail account. I have set the Exchange ActiveSync account as the default but it makes no difference. The application is used in a corporate environment only.
You can go ahead and clear defaults from Manage Apps screen in Settings. That should solve ur problem.
I had exactly the same issue in my project. There is a small bug in the referenced code.
The first line should read
emailIntent.setType("text/plain");
instead of
emailIntent.setType("plain/text");
This fixed it for me. Hope this helps.
精彩评论