i'm in quite weird situation right now. full code, here can see: http://javapapers.com/android/android-email-app-with-gmail-smtp-using-javamail/
i'm using code sending email purposes. problem ahead. have 100% success rate while sending mail using method on wifi. when use mobile data (4g), have success-rate of 30%. on devices, doesn't work @ all. there's no problem 4g connection. it's not fluctuating. it's working fine. tried wi-fi , mobile data thing on multiple devices. indicates there's problem code on mobile data.
currently on debug device on mobile data, code working. hence can't post logcat now. many times doesn't work on debug device. right since it's working, can't post logcat. probably, problem in section of code:
try { transport transport = mailsession.gettransport("smtp"); transport.connect(emailhost, fromemail, frompassword); log.i("gmail", "allrecipients: " + emailmessage.getallrecipients()); transport.sendmessage(emailmessage, emailmessage.getallrecipients()); transport.close(); log.i("gmail", "email sent successfully."); }catch (exception e){ }
while reading others' thread, came know there may problem proxy settings. in code, don't know can use proxy.noproxy
kind of thing. full code available in above link. haven't modified (except adding own email , password).
here's failure logcat:
08-09 19:29:54.594 9551-9551/com.parassidhu.cdlumaths i/sendmailactivity: send button clicked. 08-09 19:29:54.594 9551-9551/com.parassidhu.cdlumaths i/sendmailactivity: list: [cdludeubg@gmail.com] 08-09 19:29:54.654 9551-9893/com.parassidhu.cdlumaths i/d: instantiate gmail... 08-09 19:29:54.668 9551-9893/com.parassidhu.cdlumaths i/gmail: mail server properties set. [ 08-09 19:29:54.677 9551: 9893 w/ ] unable open '/system/framework/wfdcommon.jar': no such file or directory 08-09 19:29:55.000 9551-9893/com.parassidhu.cdlumaths i/gmail: toemail: cdludebug@gmail.com 08-09 19:29:55.099 9551-9893/com.parassidhu.cdlumaths i/gmail: email message created. 08-09 19:29:58.393 9551-9893/com.parassidhu.cdlumaths i/error: sendemail: null 08-09 19:29:58.393 9551-9893/com.parassidhu.cdlumaths i/com.downloadinformer: mail sent.
edit 2 on device, got logcat as:
08-10 17:44:58.911 32384-32384/com.parassidhu.cdlumaths i/sendmailactivity: send button clicked. 08-10 17:44:58.911 32384-32384/com.parassidhu.cdlumaths i/sendmailactivity: list: [cdludeubg@gmail.com] 08-10 17:44:58.922 32384-1140/com.parassidhu.cdlumaths i/d: instantiate gmail... 08-10 17:44:58.930 32384-1140/com.parassidhu.cdlumaths i/gmail: mail server properties set. 08-10 17:44:59.027 32384-1140/com.parassidhu.cdlumaths i/gmail: toemail: cdludebug@gmail.com 08-10 17:44:59.088 32384-1140/com.parassidhu.cdlumaths i/gmail: email message created. 08-10 17:44:59.095 32384-1140/com.parassidhu.cdlumaths d/libc-netbsd: [getaddrinfo]: hostname=smtp.gmail.com; servname=(null); cache_mode=(null), netid=0; mark=0 08-10 17:44:59.095 32384-1140/com.parassidhu.cdlumaths d/libc-netbsd: [getaddrinfo]: hostname=smtp.gmail.com; servname=(null); cache_mode=(null), netid=0; mark=0 08-10 17:44:59.208 32384-1140/com.parassidhu.cdlumaths d/libc-netbsd: getaddrinfo: smtp.gmail.com result proxy >> 08-10 17:44:59.219 32384-1140/com.parassidhu.cdlumaths i/system.out: [socket][0] connection smtp.gmail.com/2404:6800:4003:c00::6c:587;localport=44496(0) 08-10 17:44:59.219 32384-1140/com.parassidhu.cdlumaths i/system.out: [cds]connect[smtp.gmail.com/2404:6800:4003:c00::6c:587] tm:90 08-10 17:45:02.079 32384-1140/com.parassidhu.cdlumaths d/libc-netbsd: [getaddrinfo]: hostname=smtp.gmail.com; servname=(null); cache_mode=(null), netid=0; mark=0 08-10 17:45:02.079 32384-1140/com.parassidhu.cdlumaths d/libc-netbsd: [getaddrinfo]: hostname=smtp.gmail.com; servname=(null); cache_mode=(null), netid=0; mark=0 08-10 17:45:02.083 32384-1140/com.parassidhu.cdlumaths d/libc-netbsd: getaddrinfo: smtp.gmail.com result proxy >> 08-10 17:45:02.084 32384-1140/com.parassidhu.cdlumaths i/error: sendemail: null
it must authentication on mail server. using default android email app, still can't access email server on mobile data, , old server strange auth. double check authentication settings server side.
Comments
Post a Comment