我尝试以尽可能少的安全性连接到邮件服务器。我使用这个邮件服务器在我的本地机器上进行测试。我想配置我的WSO2 ESB实例,以便以正确的方式解析邮件消息。此时我不想购买或创建SSL证书。
当我使用mailto transport创建代理服务时,我发现它没有连接,因为我的ESB会说SSL而我的邮件服务器会说纯文本。在wso2-esb-errors.log中,我发现此错误
javax.net.ssl.SSLException:无法识别的SSL消息,明文连接?
我已经尝试了不同的方法将我的代理切换到明文模式,其中列出了参数:
https://docs.wso2.com/display/ESB481/MailTo+Transport
https://javamail.java.net/nonav/docs/api/com/sun/mail/pop3/package-summary.html
我无法弄清楚如何禁用SSL层。所以,请帮忙!
当前代理配置如下:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="mail_local_monitor"
transports="mailto"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<property name="OUT_ONLY" value="true" scope="default" type="STRING"/>
<log level="full"/>
</inSequence>
</target>
<parameter name="mail.pop3.ssl.enable">false</parameter>
<parameter name="mail.pop3.host">127.0.0.1</parameter>
<parameter name="transport.PollInterval">5</parameter>
<parameter name="mail.pop3.starttls.enable">false</parameter>
<parameter name="mail.pop3.password">12345</parameter>
<parameter name="mail.transport.protocol">pop3</parameter>
<parameter name="mail.pop3.user">esb@mail.local</parameter>
<parameter name="transport.mail.ContentType">text/plain</parameter>
<parameter name="mail.pop3.port">110</parameter>
<parameter name="transport.mail.Address">esb@mail.local</parameter>
<parameter name="transport.mail.Protocol">pop3</parameter>
<description/>
</proxy>
完整错误输出:
2014-10-09 17:24:16,971 [-] [mailto-Worker-6] ERROR MailTransportListener Error connecting to mail server for address : esb@mail.local :: Connect failed
javax.mail.MessagingException: Connect failed;
nested exception is:
javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:148)
at javax.mail.Service.connect(Service.java:275)
at javax.mail.Service.connect(Service.java:156)
at javax.mail.Service.connect(Service.java:176)
at org.apache.axis2.transport.mail.MailTransportListener.checkMail(MailTransportListener.java:115)
at org.apache.axis2.transport.mail.MailTransportListener.poll(MailTransportListener.java:80)
at org.apache.axis2.transport.mail.MailTransportListener.poll(MailTransportListener.java:61)
at org.apache.axis2.transport.base.AbstractPollingTransportListener$1$1.run(AbstractPollingTransportListener.java:67)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
at sun.security.ssl.InputRecord.handleUnknownRecord(InputRecord.java:671)
at sun.security.ssl.InputRecord.read(InputRecord.java:504)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:927)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1312)
at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:882)
at sun.security.ssl.AppInputStream.read(AppInputStream.java:102)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
at java.io.BufferedInputStream.read(BufferedInputStream.java:254)
at java.io.DataInputStream.readLine(DataInputStream.java:513)
at com.sun.mail.pop3.Protocol.simpleCommand(Protocol.java:347)
at com.sun.mail.pop3.Protocol.<init>(Protocol.java:91)
at com.sun.mail.pop3.POP3Store.getPort(POP3Store.java:201)
at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:144)
... 11 more