4

I searched a lot from internet for this thing. But everywhere very complex code. Can anybody provide me simple code to send an automatic email without user interaction from my device?

may be very simple steps like

  1. Create an email client object.
  2. Set To,From,subject and body.
  3. Send the mail with Success or fail status.

Is it possible?

Surjya Narayana Padhi
  • 7,741
  • 25
  • 81
  • 130
  • 1
    possible duplicate of [Send auto email programmatically](http://stackoverflow.com/questions/4668871/send-auto-email-programmatically) – Ron Sep 25 '11 at 04:26
  • possible duplicate of [Sending Email in Android using JavaMail API without using the default/built-in app](http://stackoverflow.com/questions/2020088/sending-email-in-android-using-javamail-api-without-using-the-default-built-in-a) – Vikas Sep 03 '12 at 15:38

2 Answers2

2

No, you can not send automatic emails without user interaction via Gmail or other in-built emails apps. If you could this would be an apparent security risk, wouldn't it?

What you can do is send an Intent that invokes the in-built email app. The user then decides to send/cancel it.

Peter Knego
  • 79,991
  • 11
  • 123
  • 154
  • The only way to do this automatically is to ask user for username & password to their account (this is what example in another answer does). Are people seriously doing this? Asking users for username&pass to their gmail account? I never encountered an app that would do this, but if I did I'd report them to Google immediately! – Peter Knego Apr 27 '14 at 18:22
  • You can create app-specific passwords for this purpose, which can be revoked at any time: https://security.google.com/settings/security/apppasswords – Will Sheppard Sep 20 '16 at 10:01
0

I found the code with JAR files and I am using it with that. Thanks for all your efforts.

Surjya Narayana Padhi
  • 7,741
  • 25
  • 81
  • 130