1
현재 James Mail Server를 조사 중이며 로컬 컴퓨터에서 인스턴스를 실행 중입니다. I가 here 나열된 단계를 따라했습니다 transport.connect(host, userName, password)
STARTTLS를 사용하여 localhost에서 메일을 보내는 동안 인식 할 수없는 SSL 메시지
DEBUG: setDebug: JavaMail version 1.4.2
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: trying to connect to host "127.0.0.1", port 465, isSSL true
DEBUG SMTP: exception reading response: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
javax.mail.MessagingException: Exception reading response;
nested exception is:
javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1764)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1523)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:453)
at javax.mail.Service.connect(Service.java:291)
at javax.mail.Service.connect(Service.java:172)
at com.spectramd.securemail.bouncycastle.JavaMailTest.send(JavaMailTest.java:50)
at com.spectramd.securemail.bouncycastle.JavaMailTest.main(JavaMailTest.java:24)
Caused by: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
at com.sun.net.ssl.internal.ssl.InputRecord.handleUnknownRecord(Unknown Source)
at com.sun.net.ssl.internal.ssl.InputRecord.read(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(Unknown Source)
at com.sun.net.ssl.internal.ssl.AppInputStream.read(Unknown Source)
at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:106)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:84)
at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1742)
... 6 more
에서 아래의 예외가 발생
public static void send() {
try {
String host = "127.0.0.1";
Properties props = System.getProperties();
props.put("mail.host", host);
props.put("mail.transport.protocol", "smtps");
props.put("mail.smtps.auth", "true");
props.put("mail.smtps.port", "465");
props.put("mail.smtps.ssl.trust", host);
Session mailSession = Session.getInstance(props);
mailSession.setDebug(true);
Message msg = new MimeMessage(mailSession);
msg.setFrom(new InternetAddress(frAddress));
InternetAddress[] address = { new InternetAddress(toAddress) };
msg.setRecipients(Message.RecipientType.TO, address);
msg.setSubject(subject);
msg.setSentDate(new Date());
msg.setText(message);
Transport transport = mailSession.getTransport("smtps");
transport.connect(host, userName, password);
transport.sendMessage(msg, msg.getAllRecipients());
transport.close();
} catch (Exception ex) {
ex.printStackTrace(System.err);
}
}
: 나는 더 아래 나열된 예외로 실행하고하여 아래의 코드를 사용하여 이메일을 보내려고하고있다 SSL에서 시작하도록 James 서버를 구성하고 단계별로 더미 JKS 인증서를 추가하십시오. 나는 온라인에서 찾고 있었지만 지금까지는 해결책을 찾지 못했습니다. Plz 도움.
편집 :
이 얘기를 깜빡 했네요, 나는 성공적으로 제임스와 함께 제공되는 기본 구성으로 일반 SMTP를 사용하여 메일을 보낼 수 있어요.
굉장히 이상하네요 !! Java 1.6.0_27을 사용하고 있습니다. 왜 JavaMail이 v1.4.2에 있는지 확실하지 않습니다 !!! 이것은 cmd에서'java -version' 명령을 트리거 할뿐만 아니라 이클립스의 설치된 JRE 섹션에서도 확인되었습니다. 또한'telnet 127.0.0.1 465'는 제임스 출력 화면에서 빈 화면을 보여줍니다'INFO 11 : 42 : 21,501 | james.smtpserver | Id = '909048548'User = ''Connection established from 127.0.0.1' – Sumit
mail.jar를 1.4.7로 업그레이드하면 문제가 해결되었습니다. 고마워요 !!! – Sumit
최신 버전은 1.5.2입니다. 나는 당신에게 최신 버전을 지적했을 때 왜 1.4.7을 선택 했습니까? –