0

I want to send an email automatically without any user intervention to a particular id. To send mail,username and password of the device from which I am sending,has to be authenticated. I am able to get the registered account name from my phone using

Account[] accounts = AccountManager.get(this).getAccounts();
for (Account account : accounts) {
       String  possibleEmail = account.name;
}

I know my password,so I am sending hardcoded password to authenticate.Is it possible to get password programatically?

Sanjay
  • 443
  • 1
  • 7
  • 22
  • Hi Nagendra, Do you want to send email without calling intent? Means you don't want to show that screen for setting subject line, message body. Right? – Krishna Suthar Apr 16 '12 at 07:03
  • Here is a good example for auto sending email [Click here][1] [1]: http://stackoverflow.com/questions/2020088/sending-email-in-android-using-javamail-api-without-using-the-default-android-ap/2033124#2033124 – Narendra Apr 16 '12 at 07:04
  • @Krishna....Exactly...I don want to show the screen to the user... – Sanjay Apr 17 '12 at 05:28

2 Answers2

1

Nope. You can't get a password from the AccountManager. Look at the docs to see how it works.

http://developer.android.com/reference/android/accounts/AccountManager.html

Kumar Bibek
  • 9,016
  • 2
  • 39
  • 68
0

No its not possible get the password

KMI
  • 496
  • 4
  • 24
  • Ok...If I want to send email from an android device,the account registered in that device has to be authenticated right? So can I ask the user to enter his username and password in my application?I saw one application called cobra tag..Here it is implemented in the same way. – Sanjay Apr 17 '12 at 05:31