android - I can't receive the email I programed to send -
i new android studio. want send email automatically android tablet, not app such gmail. several tutorials, such sending email , asynctask. here code.
public class sendingdata extends appcompatactivity implements view.onclicklistener { // webview webview; // string newurl;
//simpledateformat formatter = new simpledateformat("yyyy.mm.dd 'at' hh"); //date present = new date(); //string filename = formatter.format(present) + ".txt"; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_sending_data); init1(); strictmode.threadpolicy policy = new strictmode.threadpolicy.builder().permitall().build(); strictmode.setthreadpolicy(policy); button mail2 = (button) findviewbyid(r.id.button2); mail2.setonclicklistener(this); } @override public void onclick(view v) { new asynctask<void, void, void>(){ @override public void doinbackground(void... arg){ try{ string filename = "mps.txt"; file filelocation = new file( environment.getexternalstoragedirectory().getabsolutepath(), filename); newemail mail = new newemail(); mail.sendmail("this subject", "this body", "wiscxrayastro@gmail.com", "plyu3@wisc.edu"); } catch(exception e){ log.e("sendmail", e.getmessage(), e); } return null;} }.execute(); string filename = "mps.txt"; file filelocation = new file(environment.getexternalstoragedirectory().getabsolutepath(), filename); toast.maketext(this, "email sent!", toast.length_long).show(); }
the problem when click send email button, tablet shows "sent!". however, nothing happens in mail box. confused. don't know happening. can me? thanks.
Comments
Post a Comment