android - Unable to send email in background though there is no exception -


i'm trying send email in background android app on button click based on so answer. check if i've got email, nothing.

this button's onclick

 @override         public void onclick(view view) {             //databasehelper.delete();             if(!(fromlocation.gettext().tostring().equals(destination.gettext().tostring())))             {                 databasehelper.savebookingdetails(sessionmanager.getuseremail(),selecteddateview.gettext().tostring(), timepicker.gettext().tostring(),vehiclepick.getselecteditem().tostring(), fromlocation.gettext().tostring(), destination.gettext().tostring());                 try {                     gmailsender sender = new gmailsender("from@gmail.com", "password");                     sender.sendmail("this subject",                             "this body",                             "from@gmail.com",                             "to@outlook.com");                 } catch (exception e) {                     log.e("sendmail", e.getmessage(), e);                 }              }else toast.maketext(getactivity(), " destination & pickup location cannot same", toast.length_long).show();          }     }); 

the other 2 classes gmailsender,jsseprovider i've copied , used it. have added 3 jar files too. should use asynctask? doing wrong? maybe gmail not allowing me login app send mail?

turn on access less secure apps https://www.google.com/settings/security/lesssecureapps in above mentioned link , try again


Comments