3

I want to send a mail when user clicks a button and also i should not get any interaction after that and mail should be sent automatically using email client in the mobile.

Please help me to find the solution.

Thanks in advance.

krishna kumar
  • 153
  • 1
  • 6
  • 14

3 Answers3

2

I agree with @TGMClains if u want that there is no user interaction with the mail client in the phone then you need to create your own email client ...check out this following post.

Sending Email in Android using JavaMail API without using the default/built-in app

Hope this solves your problem

Community
  • 1
  • 1
Karan_Rana
  • 2,813
  • 2
  • 26
  • 35
  • i had checked it several times.My requirement is i need my app to integrate with default mail client and send mail automatically. – krishna kumar Feb 17 '13 at 18:06
0

Simply it is not possible to send the email through email client like Gmail without user interaction.

Instead of Java Mail API, I recommend you to make any Web API in PHP and code there to send the mail and call this Web API in your Android code.

Ajay S
  • 48,003
  • 27
  • 91
  • 111
  • Then is there possibility get the email client's email-id and password and use it in Java Mail API to send mail automatically? – krishna kumar Feb 17 '13 at 14:37
  • http://stackoverflow.com/questions/4624682/retrieve-gmail-account-details-configured-in-android check it – Ajay S Feb 17 '13 at 15:04
  • but i don't think you will able to get password of gmail, yahoo account from third party application. because it loose the security. – Ajay S Feb 17 '13 at 15:05
  • so is there way to create custom email client to send mail automatically without java api? – krishna kumar Feb 17 '13 at 18:04
  • @krishna kumar Last option i told you user earlier you have to use Java MAIL API for that. – Ajay S Feb 17 '13 at 18:04
  • 1
    but my problem is app should not ask user email or password,where Java Mail API does ask for username and password. – krishna kumar Feb 17 '13 at 18:08
0

In your onClick() put this :

startActivity(new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:to@gmail.com"));
baldguy
  • 2,090
  • 1
  • 16
  • 25