1

I am following this tutorial for sending Emails from My App.

When i try to run this in my device its getting error as authentication failed because of Google New Policy

here is screenshot of google mailenter image description here

so is there any updated solution for send email in background ?

Community
  • 1
  • 1
Abdul Rahman Majeed
  • 1,125
  • 2
  • 10
  • 22
  • Have you tried turning [this](https://www.google.com/settings/security/lesssecureapps) off? – Dipen Shah Sep 04 '15 at 12:20
  • I think your question was already answered here: [http://stackoverflow.com/questions/2020088/sending-email-in-android-using-javamail-api-without-using-the-default-built-in-a][1] [1]: http://stackoverflow.com/questions/2020088/sending-email-in-android-using-javamail-api-without-using-the-default-built-in-a – user5292387 Sep 04 '15 at 12:33
  • You also might want to try this [development version of JavaMail for Android](https://java.net/projects/javamail/pages/Android), especially if you want to use [OAuth2 authentication](https://java.net/projects/javamail/pages/OAuth2) instead of enabling support for less secure apps. – Bill Shannon Sep 04 '15 at 21:16

1 Answers1

2

You need to properly setup your Gmail account.

If you have 2-step verification enabled:

  • Please follow this tutorial to create an app password for your app.

If you don't have 2-step verification enabled:

  • Simply enable less secure apps login here.

I don't recommend it, though. I believe your password is stored in plain text as a String value, right?
A little bit of reverse engineering and it's out in the public.

Paulo Avelar
  • 2,140
  • 1
  • 17
  • 31