0
방금 전에 필요한 사용자에게 System.Net.NetworkCredential이 있다는 것을 알았습니다. javamail에 어떤 속성이나 비슷한 것이 있습니까?javamail의 System.Net.NetworkCredential 속성은 무엇입니까?
final String username = "[email protected]";
final String password = "XXXXXXXX";
Properties props = new Properties();
props.put("mail.smtp.host", "SMTP.mysmtphost.com");
props.put("mail.debug", "false");
props.put("mail.smtp.port", "25");
props.put("mail.smtp.timeout", "60000");
props.put("mail.smtp.auth", "false");
props.put("mail.smtp.ssl.enable", "true");
props.put("mail.smtp.ssl.trust", "*");
Session session = Session.getInstance(props);
Message message = new MimeMessage(session);
try {
session.setDebug(true);
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("CLIENTE INSATISFECHO");
message.setText("Estimados Gerentes: \n "
+ " El Cliente "
+ name
+ " del área de "
+ Area
+ ", con factura "
+ Factura
+ " ha manifestado estar insatisfecho, en cuanto a "
+ Descontentos
+ ". Favor de dar seguimiento en éste momento. \n\n"
+ "Atentamente\n"
+"Dirección de lealtad y Atención a Clientes.");
Transport transport = session.getTransport("smtp");
transport.connect();
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();
}
내 디버그 : 나는
다음은 내 코드 싹둑의 ... 난 그냥 사용할 코드를 확인하기 때문에 물어 있지만 C#으로 작성된 것 내가 어떻게있는 javamail에 그것을 넣어하는 아무 생각이 없다 로그인, 내가 응답, 응답 코드 (454)를 받고 있어요 : 454 5.7.3 클라이언트가이 서버에 메일을 전송할 수있는 권한이 없습니다 :10-13 19:01:42.584: I/System.out(2509): DEBUG: setDebug: JavaMail version 1.4.1
10-13 19:01:42.624: I/System.out(2509): DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc.,1.4.1]
10-13 19:01:42.635: I/System.out(2509): DEBUG SMTP: useEhlo true, useAuth false
10-13 19:01:42.675: I/System.out(2509): DEBUG SMTP: trying to connect to host "SMTP.grupoautofin.com", port 25, isSSL false
10-13 19:01:42.825: I/System.out(2509): 220 mtysmtp01.mexico.hosting.triara SMTP Server 01 is ready. Mon, 13 Oct 2014 18:01:42 -0500
10-13 19:01:42.825: I/System.out(2509): DEBUG SMTP: connected to host "SMTP.grupoautofin.com", port: 25
10-13 19:01:42.845: I/System.out(2509): EHLO localhost
10-13 19:01:43.205: I/System.out(2509): 250-mtysmtp01.mexico.hosting.triara Hello [189.203.255.42]
10-13 19:01:43.224: I/System.out(2509): 250-TURN
10-13 19:01:43.224: I/System.out(2509): 250-SIZE 27262976
10-13 19:01:43.224: I/System.out(2509): 250-ETRN
10-13 19:01:43.224: I/System.out(2509): 250-PIPELINING
10-13 19:01:43.224: I/System.out(2509): 250-DSN
10-13 19:01:43.224: I/System.out(2509): 250-ENHANCEDSTATUSCODES
10-13 19:01:43.224: I/System.out(2509): 250-8bitmime
10-13 19:01:43.235: I/System.out(2509): 250-BINARYMIME
10-13 19:01:43.235: I/System.out(2509): 250-CHUNKING
10-13 19:01:43.235: I/System.out(2509): 250-VRFY
10-13 19:01:43.235: I/System.out(2509): 250-X-EXPS GSSAPI NTLM LOGIN
10-13 19:01:43.235: I/System.out(2509): 250-X-EXPS=LOGIN
10-13 19:01:43.235: I/System.out(2509): 250-AUTH GSSAPI NTLM LOGIN
10-13 19:01:43.235: I/System.out(2509): 250-AUTH=LOGIN
10-13 19:01:43.235: I/System.out(2509): 250-X-LINK2STATE
10-13 19:01:43.235: I/System.out(2509): 250-XEXCH50
10-13 19:01:43.235: I/System.out(2509): 250 OK
10-13 19:01:43.255: I/System.out(2509): DEBUG SMTP: Found extension "TURN", arg ""
10-13 19:01:43.255: I/System.out(2509): DEBUG SMTP: Found extension "SIZE", arg "27262976"
10-13 19:01:43.255: I/System.out(2509): DEBUG SMTP: Found extension "ETRN", arg ""
10-13 19:01:43.255: I/System.out(2509): DEBUG SMTP: Found extension "PIPELINING", arg ""
10-13 19:01:43.255: I/System.out(2509): DEBUG SMTP: Found extension "DSN", arg ""
10-13 19:01:43.265: I/System.out(2509): DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""
10-13 19:01:43.265: I/System.out(2509): DEBUG SMTP: Found extension "8bitmime", arg ""
10-13 19:01:43.275: I/System.out(2509): DEBUG SMTP: Found extension "BINARYMIME", arg ""
10-13 19:01:43.275: I/System.out(2509): DEBUG SMTP: Found extension "CHUNKING", arg ""
10-13 19:01:43.275: I/System.out(2509): DEBUG SMTP: Found extension "VRFY", arg ""
10-13 19:01:43.285: I/System.out(2509): DEBUG SMTP: Found extension "X-EXPS", arg "GSSAPI NTLM LOGIN"
10-13 19:01:43.285: I/System.out(2509): DEBUG SMTP: Found extension "X-EXPS=LOGIN", arg ""
10-13 19:01:43.295: I/System.out(2509): DEBUG SMTP: Found extension "AUTH", arg "GSSAPI NTLM LOGIN"
10-13 19:01:43.295: I/System.out(2509): DEBUG SMTP: Found extension "AUTH=LOGIN", arg ""
10-13 19:01:43.335: I/System.out(2509): DEBUG SMTP: Found extension "X-LINK2STATE", arg ""
10-13 19:01:43.335: I/System.out(2509): DEBUG SMTP: Found extension "XEXCH50", arg ""
10-13 19:01:43.345: I/System.out(2509): DEBUG SMTP: Found extension "OK", arg ""
10-13 19:01:43.355: I/System.out(2509): DEBUG SMTP: use8bit false
10-13 19:01:43.365: I/System.out(2509): MAIL FROM:<[email protected]>
10-13 19:01:43.424: I/System.out(2509): 454 5.7.3 Client does not have permission to submit mail to this server.
10-13 19:01:43.424: I/System.out(2509): DEBUG SMTP: got response code 454, with response: 454 5.7.3 Client does not have permission to submit mail to this server.
10-13 19:01:43.424: I/System.out(2509): RSET
10-13 19:01:43.424: I/System.out(2509): DEBUG SMTP: EOF: [EOF]
10-13 19:01:43.436: I/System.out(2509): javax.mail.MessagingException: [EOF]
10-13 19:01:43.436: I/System.out(2509): at com.sun.mail.smtp.SMTPTransport.issueCommand(SMTPTransport.java:1481)
10-13 19:01:43.436: I/System.out(2509): at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1512)
10-13 19:01:43.436: I/System.out(2509): at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:1054)
10-13 19:01:43.444: I/System.out(2509): at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:634)
10-13 19:01:43.444: I/System.out(2509): at com.example.firmaclientes.EmailSender.EnviandoMail(EmailSender.java:94)
10-13 19:01:43.444: I/System.out(2509): at com.example.firmaclientes.MainActivity$AsyncMAIL.doInBackground(MainActivity.java:694)
10-13 19:01:43.444: I/System.out(2509): at com.example.firmaclientes.MainActivity$AsyncMAIL.doInBackground(MainActivity.java:1)
10-13 19:01:43.444: I/System.out(2509): at android.os.AsyncTask$2.call(AsyncTask.java:287)
10-13 19:01:43.444: I/System.out(2509): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
10-13 19:01:43.455: I/System.out(2509): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
10-13 19:01:43.455: I/System.out(2509): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
10-13 19:01:43.455: I/System.out(2509): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
10-13 19:01:43.455: I/System.out(2509): at java.lang.Thread.run(Thread.java:841)
10-13 19:01:43.465: E/ERROR ENVIANDO:(2509): [EOF]javax.mail.MessagingException: [EOF]
mail.smtp.ssl.enable을 사용하도록 설정하면 오류가 발생하고 연결되지 않습니다 ... 내 도메인은 Office 365 도메인이며, 아마도 그 도메인과 관련이 있는지 몰라요? –
정확히 어떤 오류가 있습니까? 서버가 STARTTLS **를 지원하지 않을 가능성이 매우 낮고 ** SSL 포트에서 수신 대기하지 않습니다. Office 365는 Windows Live 메일과 비슷합니까? [msgshow.java 샘플 프로그램] (https://java.net/projects/javamail/pages/Home#Samples)과 [this JavaMail FAQ 항목] (http://www.oracle.com/)을 사용할 수 있습니다. technetwork/java/javamail/faq/index.html # hotmail)을 사용하여 기본 연결을 얻을 수 있는지 확인하십시오. –
SSL 연결을 업그레이드하고 실제로 제거하면 문제가 해결되었으므로 사용하고 있던 오류로 인해 발생한 오류라고 생각합니다. 또한 내가 게시 한 SMTP 대신 office365 SMTP를 사용해야했습니다. –