이메일을 자동으로 보내는 웹 앱을 만들고 있으므로 javamail을 사용하고 있습니다. 내 회사의 SMPT를 사용해야하고, nulljavax.mail.AuthenticationFailedException이 무엇이든지 상관없이. 제가 처음 사용했을 때 처음이었고 많은 해결책을 시도했지만 여전히 잘못된 것을 파악할 수 없었기 때문에 저는 정말 좌절했습니다. 나는 gmail을 사용하여 테스트를했고 효과가 있었지만 지금까지 아무 것도 도움이되지 못했습니다. 여기에 내 코드가있다 :왜 nulljavax.mail.AuthenticationFailedException이 발생합니까?
업데이트 : 나는 내 코드를 변경했으며, 제안 된대로 인증자를 제거했다. 디버그 메시지와 지금 또한
final String username = "[email protected]";
final String password = "Leprechaun01";
Properties props = new Properties();
props.put("mail.transport.protocol", "smtp");
props.put("mail.smtp.auth", "true");
Session session = Session.getInstance(props);
try {
session.setDebug(true);
Message message = new MimeMessage(session);
message.setFrom(new InternetAddress("[email protected]"));
message.setRecipients(Message.RecipientType.TO,
InternetAddress.parse("[email protected]"));
message.setRecipients(Message.RecipientType.CC,
InternetAddress.parse(Copy));
message.setSubject("Testing Subject");
message.setText("Dear Mail Crawler,"
+ "\n\n No spam to my email, please!");
Transport transport = session.getTransport("smtp");
transport.connect("SMTP.grupoautofin.com", 25, username, password);
transport.sendMessage(message, message.getAllRecipients());
transport.close();
Log.i("Estás enviando: ",""+message.toString());
System.out.println("Done");
}catch(AuthenticationFailedException e) {
Log.e("ERROR DE AUTENTIFICACION: ",""+e.getMessage()+e);
e.printStackTrace();
bandera = false;
} catch (MessagingException e) {
bandera=false;
Log.e("ERROR ENVIANDO: ",""+e.getMessage()+e);
e.printStackTrace();
//throw new RuntimeException(e);
}
, 내 오류 로그 :
10-13 15:56:13.504: I/System.out(802): DEBUG: setDebug: JavaMail version 1.4.1
10-13 15:56:13.544: I/System.out(802): DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc.,1.4.1]
10-13 15:56:13.544: I/System.out(802): DEBUG SMTP: useEhlo true, useAuth true
10-13 15:56:13.544: I/System.out(802): DEBUG SMTP: trying to connect to host "SMTP.grupoautofin.com", port 25, isSSL false
10-13 15:56:13.835: I/System.out(802): 220 mtysmtp01.mexico.hosting.triara SMTP Server 01 is ready. Mon, 13 Oct 2014 14:56:13 -0500
10-13 15:56:13.845: I/System.out(802): DEBUG SMTP: connected to host "SMTP.grupoautofin.com", port: 25
10-13 15:56:13.855: I/System.out(802): EHLO localhost
10-13 15:56:13.905: I/System.out(802): 250-mtysmtp01.mexico.hosting.triara Hello [189.203.255.42]
10-13 15:56:13.905: I/System.out(802): 250-TURN
10-13 15:56:13.905: I/System.out(802): 250-SIZE 27262976
10-13 15:56:13.915: I/System.out(802): 250-ETRN
10-13 15:56:13.915: I/System.out(802): 250-PIPELINING
10-13 15:56:13.915: I/System.out(802): 250-DSN
10-13 15:56:13.915: I/System.out(802): 250-ENHANCEDSTATUSCODES
10-13 15:56:13.915: I/System.out(802): 250-8bitmime
10-13 15:56:13.915: I/System.out(802): 250-BINARYMIME
10-13 15:56:13.915: I/System.out(802): 250-CHUNKING
10-13 15:56:13.915: I/System.out(802): 250-VRFY
10-13 15:56:13.915: I/System.out(802): 250-X-EXPS GSSAPI NTLM LOGIN
10-13 15:56:13.915: I/System.out(802): 250-X-EXPS=LOGIN
10-13 15:56:13.925: I/System.out(802): 250-AUTH GSSAPI NTLM LOGIN
10-13 15:56:13.925: I/System.out(802): 250-AUTH=LOGIN
10-13 15:56:13.925: I/System.out(802): 250-X-LINK2STATE
10-13 15:56:13.925: I/System.out(802): 250-XEXCH50
10-13 15:56:13.925: I/System.out(802): 250 OK
10-13 15:56:13.935: I/System.out(802): DEBUG SMTP: Found extension "TURN", arg ""
10-13 15:56:13.935: I/System.out(802): DEBUG SMTP: Found extension "SIZE", arg "27262976"
10-13 15:56:13.945: I/System.out(802): DEBUG SMTP: Found extension "ETRN", arg ""
10-13 15:56:13.945: I/System.out(802): DEBUG SMTP: Found extension "PIPELINING", arg ""
10-13 15:56:13.945: I/System.out(802): DEBUG SMTP: Found extension "DSN", arg ""
10-13 15:56:13.945: I/System.out(802): DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""
10-13 15:56:13.955: I/System.out(802): DEBUG SMTP: Found extension "8bitmime", arg ""
10-13 15:56:13.955: I/System.out(802): DEBUG SMTP: Found extension "BINARYMIME", arg ""
10-13 15:56:13.955: I/System.out(802): DEBUG SMTP: Found extension "CHUNKING", arg ""
10-13 15:56:13.965: I/System.out(802): DEBUG SMTP: Found extension "VRFY", arg ""
10-13 15:56:13.965: I/System.out(802): DEBUG SMTP: Found extension "X-EXPS", arg "GSSAPI NTLM LOGIN"
10-13 15:56:13.965: I/System.out(802): DEBUG SMTP: Found extension "X-EXPS=LOGIN", arg ""
10-13 15:56:13.975: I/System.out(802): DEBUG SMTP: Found extension "AUTH", arg "GSSAPI NTLM LOGIN"
10-13 15:56:13.975: I/System.out(802): DEBUG SMTP: Found extension "AUTH=LOGIN", arg ""
10-13 15:56:13.985: I/System.out(802): DEBUG SMTP: Found extension "X-LINK2STATE", arg ""
10-13 15:56:14.004: I/System.out(802): DEBUG SMTP: Found extension "XEXCH50", arg ""
10-13 15:56:14.004: I/System.out(802): DEBUG SMTP: Found extension "OK", arg ""
10-13 15:56:14.015: I/System.out(802): DEBUG SMTP: Attempt to authenticate
10-13 15:56:14.025: I/System.out(802): AUTH LOGIN
10-13 15:56:14.075: I/System.out(802): 334 VXNlcm5hbWU6
10-13 15:56:14.085: I/System.out(802): ZHZhLmNsYW1hZHJpZEBncnVwb2F1dG9maW4uY29t
10-13 15:56:14.135: I/System.out(802): 334 UGFzc3dvcmQ6
10-13 15:56:14.135: I/System.out(802): TGVwcmVjaGF1bjAx
10-13 15:56:14.416: I/System.out(802): 535 5.7.3 Authentication unsuccessful.
10-13 15:56:14.424: E/ERROR DE AUTENTIFICACION:(802): nulljavax.mail.AuthenticationFailedException
여전히 같은 오류가
없어 내가 뭘 잘못? 미리 감사드립니다.
감사합니다. –
필요한 수정 작업을 수행했지만 문제가 지속되지만 다른 측면을 보여줍니다 ... –
먼저 JavaMail의 아주 오래된 버전을 사용하고 있습니다. 결과적으로 인증 프로토콜 추적은 디버그 출력에 포함되며, 누구든지 암호를 읽을 수 있도록 해독 할 수 있습니다. 암호를 즉시 변경하십시오. 둘째, 이전에 mail.smtp.starttls.enable 속성을 설정하지 않았습니까? 그것은 이제 사라진 것 같습니다. 그리고 인증 전에 SSL/TLS로 전환해야하므로 서버가 비밀번호를 기꺼이 받아 들일 것입니다. –