Android 계정 관리자를 사용하여 Gmail로가는 길을 인증하므로 장치에서 전자 메일을 보낼 수 있습니다. 디코딩Javamail 및 계정 관리자 (오류 400)를 사용하여 Gmail 전자 메일을 보낼 수 없습니다.
E/SMTP TRANSPORT ERROR﹕ 334 eyJzdGF0dXMiOiI0MDAiLCJzY2hlbWVzIjoiQmVhcmVyIiwic2NvcGUiOiJodHRwczovL21haWwuZ29vZ2xlLmNvbS8ifQ==
class javax.mail.MessagingException
읽기 :
{"status":"400","schemes":"Bearer","scope":"https://mail.google.com/"}
송신 과정은 모든 것이 연결하고 괜찮 인증하지만 나에게 다음과 같은 오류를 제공합니다 (로그에서) 나타납니다 동안
다른 SO 질문에서 토큰이 만료되었다는 것을 알았습니다. 그러나 이것은 나의 경우에 해당하지는 않습니다. 토큰을 무효화하고 새 토큰을 얻으려고했습니다. 같은 문제. 여기내가 인증 방법은 다음과 같습니다
am = AccountManager.get(this);
options = new Bundle();
Account me = null;
Account[] accounts = am.getAccounts();
for(Account a: accounts){
if(a.name.equals(TEST_ACCOUNT_EMAIL) && a.type.equals("com.google")){
me = a;
}
}
if (me != null){
am.getAuthToken(me, "oauth2:https://mail.google.com/", null, this, new OnTokenAcquired(), null);
}
가 여기에 내가 나 자신 (참고 인증 성공)
03-04 18:20:15.875 4847-5263/com.samay.markasread2 I/System.out﹕ DEBUG: setDebug: JavaMail version 1.4.1
03-04 18:20:15.875 4847-5263/com.samay.markasread2 I/System.out﹕ DEBUG: mail.imap.fetchsize: 16384
03-04 18:20:15.885 4847-5263/com.samay.markasread2 I/System.out﹕ DEBUG: enable SASL
03-04 18:20:15.885 4847-5263/com.samay.markasread2 I/System.out﹕ DEBUG: SASL mechanisms allowed: XOAUTH2
03-04 18:20:16.175 4847-4859/com.samay.markasread2 I/System.out﹕ A3 LOGOUT
03-04 18:20:16.175 4847-4859/com.samay.markasread2 I/System.out﹕ DEBUG: IMAPStore connection dead
03-04 18:20:16.175 4847-4859/com.samay.markasread2 I/System.out﹕ DEBUG: IMAPStore cleanup, force true
03-04 18:20:16.175 4847-4859/com.samay.markasread2 I/System.out﹕ DEBUG: IMAPStore cleanup done
03-04 18:20:16.185 4847-4859/com.samay.markasread2 I/System.out﹕ A3 LOGOUT
03-04 18:20:16.336 4847-4859/com.samay.markasread2 I/System.out﹕ * BYE LOGOUT Requested
03-04 18:20:16.336 4847-4859/com.samay.markasread2 I/System.out﹕ A3 OK 73 good day (Success)
03-04 18:20:16.336 4847-4859/com.samay.markasread2 I/System.out﹕ DEBUG: IMAPStore connection dead
03-04 18:20:16.336 4847-4859/com.samay.markasread2 I/System.out﹕ DEBUG: IMAPStore cleanup, force false
03-04 18:20:16.336 4847-4859/com.samay.markasread2 I/System.out﹕ DEBUG: IMAPStore cleanup done
03-04 18:20:16.346 4847-5263/com.samay.markasread2 I/System.out﹕ * OK Gimap ready for requests from 18.111.30.155 67mb91143115qga
03-04 18:20:16.346 4847-5263/com.samay.markasread2 I/System.out﹕ A0 CAPABILITY
03-04 18:20:16.446 4847-5263/com.samay.markasread2 I/System.out﹕ * CAPABILITY IMAP4rev1 UNSELECT IDLE NAMESPACE QUOTA ID XLIST CHILDREN X-GM-EXT-1 XYZZY SASL-IR AUTH=XOAUTH AUTH=XOAUTH2 AUTH=PLAIN AUTH=PLAIN-CLIENTTOKEN
03-04 18:20:16.446 4847-5263/com.samay.markasread2 I/System.out﹕ A0 OK Thats all she wrote! 67mb91143115qga
03-04 18:20:16.446 4847-5263/com.samay.markasread2 I/System.out﹕ IMAP DEBUG: AUTH: XOAUTH
03-04 18:20:16.446 4847-5263/com.samay.markasread2 I/System.out﹕ IMAP DEBUG: AUTH: XOAUTH2
03-04 18:20:16.446 4847-5263/com.samay.markasread2 I/System.out﹕ IMAP DEBUG: AUTH: PLAIN
03-04 18:20:16.446 4847-5263/com.samay.markasread2 I/System.out﹕ IMAP DEBUG: AUTH: PLAIN-CLIENTTOKEN
03-04 18:20:16.446 4847-5263/com.samay.markasread2 I/System.out﹕ DEBUG: protocolConnect login, host=imap.gmail.com, [email protected], password=<non-null>
03-04 18:20:16.446 4847-5263/com.samay.markasread2 I/System.out﹕ IMAP SASL DEBUG: Mechanisms: XOAUTH2
03-04 18:20:16.456 4847-5263/com.samay.markasread2 I/System.out﹕ IMAP SASL DEBUG: SASL client XOAUTH2
03-04 18:20:16.456 4847-5263/com.samay.markasread2 I/System.out﹕ A1 AUTHENTICATE XOAUTH2
03-04 18:20:16.546 4847-5263/com.samay.markasread2 I/System.out﹕ +
03-04 18:20:16.546 4847-5263/com.samay.markasread2 I/System.out﹕ IMAP SASL DEBUG: challenge: :
03-04 18:20:16.546 4847-5263/com.samay.markasread2 I/System.out﹕ IMAP SASL DEBUG: callback length: 1
03-04 18:20:16.546 4847-5263/com.samay.markasread2 I/System.out﹕ IMAP SASL DEBUG: callback 0: [email protected]
03-04 18:20:16.546 4847-5263/com.samay.markasread2 I/System.out﹕ IMAP SASL DEBUG: response: [email protected]=Bearer ya29.1.AADtN_UU_dI1wnX8uehx7yiIHeeI3oOTl1m5Pj3jyEZHtjpeCalTuSQvfbbhtYsG57H7IPZTDcWO5WwAKta8KvP3xYmPV3A6YbLCEBG15MDVUksRL9mMuLqH9u0 :
03-04 18:20:16.546 4847-5263/com.samay.markasread2 I/System.out﹕ dXNlcj1wdXJpcm9oYW5AZ21haWwuY29tAWF1dGg9QmVhcmVyIHlhMjkuMS5BQUR0Tl9VVV9kSTF3blg4dWVoeDd5aUlIZWVJM29PVGwxbTVQajNqeUVaSHRqcGVDYWxUdVNRdmZiYmh0WXNHNTdIN0lQWlREY1dPNVd3QUt0YThLdlAzeFltUFYzQTZZYkxDRUJHMTVNRFZVa3NSTDltTXVMcUg5dTABAQ==
03-04 18:20:16.756 4847-5263/com.samay.markasread2 I/System.out﹕ * CAPABILITY IMAP4rev1 UNSELECT IDLE NAMESPACE QUOTA ID XLIST CHILDREN X-GM-EXT-1 UIDPLUS COMPRESS=DEFLATE ENABLE MOVE CONDSTORE ESEARCH
03-04 18:20:16.756 4847-5263/com.samay.markasread2 I/System.out﹕ A1 OK [email protected] CENSORED_FIRST_NAME CENSORED_LAST_NAME authenticated (Success)
03-04 18:20:16.756 4847-5263/com.samay.markasread2 I/System.out﹕ A2 CAPABILITY
03-04 18:20:16.856 4847-5263/com.samay.markasread2 I/System.out﹕ * CAPABILITY IMAP4rev1 UNSELECT IDLE NAMESPACE QUOTA ID XLIST CHILDREN X-GM-EXT-1 UIDPLUS COMPRESS=DEFLATE ENABLE MOVE CONDSTORE ESEARCH
03-04 18:20:16.856 4847-5263/com.samay.markasread2 I/System.out﹕ A2 OK Success
03-04 18:20:16.896 4847-5263/com.samay.markasread2 I/System.out﹕ DEBUG: setDebug: JavaMail version 1.4.1
03-04 18:20:16.896 4847-5263/com.samay.markasread2 I/System.out﹕ DEBUG SMTP: useEhlo true, useAuth false
03-04 18:20:16.896 4847-5263/com.samay.markasread2 I/System.out﹕ DEBUG SMTP: trying to connect to host "smtp.gmail.com", port 587, isSSL false
03-04 18:20:17.176 4847-5263/com.samay.markasread2 I/System.out﹕ 220 mx.google.com ESMTP r40sm644209qga.23 - gsmtp
03-04 18:20:17.176 4847-5263/com.samay.markasread2 I/System.out﹕ DEBUG SMTP: connected to host "smtp.gmail.com", port: 587
03-04 18:20:17.176 4847-5263/com.samay.markasread2 I/System.out﹕ EHLO localhost
03-04 18:20:17.277 4847-5263/com.samay.markasread2 I/System.out﹕ 250-mx.google.com at your service, [18.111.30.155]
03-04 18:20:17.277 4847-5263/com.samay.markasread2 I/System.out﹕ 250-SIZE 35882577
03-04 18:20:17.277 4847-5263/com.samay.markasread2 I/System.out﹕ 250-8BITMIME
03-04 18:20:17.277 4847-5263/com.samay.markasread2 I/System.out﹕ 250-STARTTLS
03-04 18:20:17.277 4847-5263/com.samay.markasread2 I/System.out﹕ 250-ENHANCEDSTATUSCODES
03-04 18:20:17.277 4847-5263/com.samay.markasread2 I/System.out﹕ 250 CHUNKING
03-04 18:20:17.277 4847-5263/com.samay.markasread2 I/System.out﹕ DEBUG SMTP: Found extension "SIZE", arg "35882577"
03-04 18:20:17.277 4847-5263/com.samay.markasread2 I/System.out﹕ DEBUG SMTP: Found extension "8BITMIME", arg ""
03-04 18:20:17.277 4847-5263/com.samay.markasread2 I/System.out﹕ DEBUG SMTP: Found extension "STARTTLS", arg ""
03-04 18:20:17.277 4847-5263/com.samay.markasread2 I/System.out﹕ DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""
03-04 18:20:17.277 4847-5263/com.samay.markasread2 I/System.out﹕ DEBUG SMTP: Found extension "CHUNKING", arg ""
03-04 18:20:17.277 4847-5263/com.samay.markasread2 I/System.out﹕ STARTTLS
03-04 18:20:17.387 4847-5263/com.samay.markasread2 I/System.out﹕ 220 2.0.0 Ready to start TLS
03-04 18:20:17.597 4847-5263/com.samay.markasread2 I/System.out﹕ EHLO localhost
03-04 18:20:17.697 4847-5263/com.samay.markasread2 I/System.out﹕ 250-mx.google.com at your service, [18.111.30.155]
03-04 18:20:17.697 4847-5263/com.samay.markasread2 I/System.out﹕ 250-SIZE 35882577
03-04 18:20:17.697 4847-5263/com.samay.markasread2 I/System.out﹕ 250-8BITMIME
03-04 18:20:17.697 4847-5263/com.samay.markasread2 I/System.out﹕ 250-AUTH LOGIN PLAIN XOAUTH XOAUTH2 PLAIN-CLIENTTOKEN
03-04 18:20:17.697 4847-5263/com.samay.markasread2 I/System.out﹕ 250-ENHANCEDSTATUSCODES
03-04 18:20:17.697 4847-5263/com.samay.markasread2 I/System.out﹕ 250 CHUNKING
03-04 18:20:17.697 4847-5263/com.samay.markasread2 I/System.out﹕ DEBUG SMTP: Found extension "SIZE", arg "35882577"
03-04 18:20:17.697 4847-5263/com.samay.markasread2 I/System.out﹕ DEBUG SMTP: Found extension "8BITMIME", arg ""
03-04 18:20:17.697 4847-5263/com.samay.markasread2 I/System.out﹕ DEBUG SMTP: Found extension "AUTH", arg "LOGIN PLAIN XOAUTH XOAUTH2 PLAIN-CLIENTTOKEN"
03-04 18:20:17.697 4847-5263/com.samay.markasread2 I/System.out﹕ DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""
03-04 18:20:17.697 4847-5263/com.samay.markasread2 I/System.out﹕ DEBUG SMTP: Found extension "CHUNKING", arg ""
03-04 18:20:17.697 4847-5263/com.samay.markasread2 I/System.out﹕ AUTH XOAUTH2 dXNlcj1zZW5kLWFkZHJAZ21haWwuY29tAWF1dGg9QmVhcmVyIHlhMjkuMS5BQUR0Tl9VVV9kSTF3blg4dWVoeDd5aUlIZWVJM29PVGwxbTVQajNqeUVaSHRqcGVDYWxUdVNRdmZiYmh0WXNHNTdIN0lQWlREY1dPNVd3QUt0YThLdlAzeFltUFYzQTZZYkxDRUJHMTVNRFZVa3NSTDltTXVMcUg5dTABAQ==
03-04 18:20:18.007 4847-5263/com.samay.markasread2 I/System.out﹕ 334 eyJzdGF0dXMiOiI0MDAiLCJzY2hlbWVzIjoiQmVhcmVyIiwic2NvcGUiOiJodHRwczovL21haWwuZ29vZ2xlLmNvbS8ifQ==
03-04 18:20:18.007 4847-5263/com.samay.markasread2 E/SMTP TRANSPORT ERROR﹕ 334 eyJzdGF0dXMiOiI0MDAiLCJzY2hlbWVzIjoiQmVhcmVyIiwic2NvcGUiOiJodHRwczovL21haWwuZ29vZ2xlLmNvbS8ifQ==
class javax.mail.MessagingException
OAuth2 토큰이 JavaMail을 통해 사용할 수있는 유효한 Gmail 비밀번호로 간주된다는 사실을 모릅니다. 내가 여기에 지정된 구현을 사용하고 – CommonsWare
@CommonsWare : http://stackoverflow.com/questions/14682093/access-gmail-using-imap-with-accountmanager-token/14691708#comment21109529_14691708 – Rohan
@Rohan 이봐, 그래, 난 거죠 그것은이 코드를 사용하여 작동합니다 : http://stackoverflow.com/a/12821612/1692590. 나는 토큰이 만료 되었기 때문에 내가 생각했던 334 오류를 얻었지만, 그렇지 않았다. 이 경우 내가 잘못된 범위를 사용하고있는 경우입니다. 그러나, 난 그냥 내 코드를 확인하고 당신과 같은 범위를 사용하고 있습니다 ... – Jakob