As Doccumentation suggested I have also include -Djavax.net.ssl.trustStore parameter in JavaEmailServerDriver.ini file.
The .truststore file was generated by client, he also generate a .cer file.
If I try to connect using Thunderbird everything is ok (I know thunderbird use the .cer file instead of .truststore, but al least I could say connectivity is OK)
Here is the emailserver error log:
17:46:04.109 Std 20015 [MsgIn-1] JavaMail Exception.
javax.mail.MessagingException: Unable to establish handshake using SSL - server may be expecting plain text connection;
nested exception is:
javax.net.ssl.SSLException: Unable to establish handshake using SSL - server may be expecting plain text connection
at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:695)
at javax.mail.Service.connect(Service.java:381)
at com.genesyslab.icc.emailserver.MailDeliveryAgentImpl.openConnection(MailDeliveryAgentImpl.java:260)
at com.genesyslab.icc.emailserver.InboundMessagingClient$SessionRunLoop.retrieveMessages(InboundMessagingClient.java:1121)
at com.genesyslab.icc.emailserver.InboundMessagingClient$SessionRunLoop.run(InboundMessagingClient.java:993)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at com.genesyslab.util.concurrent16.NamedThreadFactory$1.run(NamedThreadFactory.java:55)
at java.lang.Thread.run(Thread.java:745)
Caused by: javax.net.ssl.SSLException: Unable to establish handshake using SSL - server may be expecting plain text connection
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:245)
at com.sun.mail.iap.Protocol.(Protocol.java:116)
at com.sun.mail.imap.protocol.IMAPProtocol.(IMAPProtocol.java:121)
at com.sun.mail.imap.IMAPStore.newIMAPProtocol(IMAPStore.java:710)
at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:659)
… 8 more
You can check it via standard keytool utility which is provided by Java in general - on internet you can find many step-by-step description how to do it. In other hand, you can enable debugging on IMAP/POP3 protocol level to be able to track the communication between exchange server and ESJ as the client. from the posted log it seems that the used certs not matching or something like that.
With the .java you shared and the procedure, I was able to add the certificate to my keystore! Definitely I was making some mistake with keytool…
Now it is working okay.
Just for the record, I chose to add the generated truststore to java home directory.
I am facing the same problem in ESJ dat the server requires plain text connection. Can you share the steps or procedures which you had done in your ESJ configuration. Please share that .java too as well
Please follow instructions shared by cavagnaro, there you will find everything you need to achieve the connection implementing SSL.
I follow this instructions and Deploying an E-Mail System in Secured Mode Procedure of eService Deployment guide.
Little bit more effort please. Because of the value is Java based, it is necessary to configure it on init level - so, it means on init file level (on Windows platform) or sh file level (on linux platform). It is described in any documentation and of course, it is standard Java-based, nothing special about Genesys itself.
10:36:21.641 Dbg 23021 [OutSbSchd] Found 0 matching messages in database in 13 ms
10:36:21.642 Dbg 23022 [OutSbSchd] Queue size : 0 (no new messages found).
10:36:21.762 Dbg 23192 [MsgIn-1] Thread ‘MsgIn-1’ registers to shutdown notification.
10:36:21.762 Trc 21621 [MsgIn-1] Running inbound messaging client.
10:36:21.763 Dbg 29999 [MsgIn-1] factory creating impl for pop/imap server
10:36:21.767 Dbg 25112 [MsgIn-1] JavaMail POP: DEBUG: mail.imap.class property exists and points to com.sun.mail.imap.IMAPSSLStore
10:36:21.767 Dbg 25112 [MsgIn-1] JavaMail POP: DEBUG IMAP: mail.imap.fetchsize: 16384
10:36:21.767 Dbg 25112 [MsgIn-1] JavaMail POP: DEBUG IMAP: mail.imap.ignorebodystructuresize: false
10:36:21.767 Dbg 25112 [MsgIn-1] JavaMail POP: DEBUG IMAP: mail.imap.statuscachetimeout: 1000
10:36:21.768 Dbg 25112 [MsgIn-1] JavaMail POP: DEBUG IMAP: mail.imap.appendbuffersize: -1
10:36:21.768 Dbg 25112 [MsgIn-1] JavaMail POP: DEBUG IMAP: mail.imap.minidletime: 10
10:36:21.768 Dbg 25112 [MsgIn-1] JavaMail POP: DEBUG IMAP: trying to connect to host “10.200.20.40”, port 993, isSSL true
10:36:21.777 Std 29997 [MsgIn-1] javax.net.ssl.SSLException: Unable to establish handshake using SSL - server may be expecting plain text connection
10:36:21.778 Std 29997 [MsgIn-1] at com.sun.mail.util.SocketFetcher.configureSSLSocket(SocketFetcher.java:576)
10:36:21.778 Std 29997 [MsgIn-1] at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:381)
10:36:21.779 Std 29997 [MsgIn-1] at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:232)
10:36:21.779 Std 29997 [MsgIn-1] at com.sun.mail.iap.Protocol.(Protocol.java:116)
10:36:21.779 Std 29997 [MsgIn-1] at com.sun.mail.imap.protocol.IMAPProtocol.(IMAPProtocol.java:121)
10:36:21.780 Std 29997 [MsgIn-1] at com.sun.mail.imap.IMAPStore.newIMAPProtocol(IMAPStore.java:710)
10:36:21.780 Std 29997 [MsgIn-1] at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:659)
10:36:21.781 Std 29997 [MsgIn-1] at javax.mail.Service.connect(Service.java:381)
10:36:21.781 Std 29997 [MsgIn-1] at com.genesyslab.icc.emailserver.MailDeliveryAgentImpl.openConnection(MailDeliveryAgentImpl.java:260)
10:36:21.782 Std 29997 [MsgIn-1] at com.genesyslab.icc.emailserver.InboundMessagingClient$SessionRunLoop.retrieveMessages(InboundMessagingClient.java:1121)
10:36:21.782 Std 29997 [MsgIn-1] at com.genesyslab.icc.emailserver.InboundMessagingClient$SessionRunLoop.run(InboundMessagingClient.java:993)
10:36:21.783 Std 29997 [MsgIn-1] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
10:36:21.783 Std 29997 [MsgIn-1] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
10:36:21.783 Std 29997 [MsgIn-1] at com.genesyslab.util.concurrent16.NamedThreadFactory$1.run(NamedThreadFactory.java:55)
10:36:21.784 Std 29997 [MsgIn-1] at java.lang.Thread.run(Thread.java:745)
10:36:21.784 Std 20015 [MsgIn-1] JavaMail Exception.
javax.mail.MessagingException: Unable to establish handshake using SSL - server may be expecting plain text connection;
nested exception is:
javax.net.ssl.SSLException: Unable to establish handshake using SSL - server may be expecting plain text connection
at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:695)
at javax.mail.Service.connect(Service.java:381)
at com.genesyslab.icc.emailserver.MailDeliveryAgentImpl.openConnection(MailDeliveryAgentImpl.java:260)
at com.genesyslab.icc.emailserver.InboundMessagingClient$SessionRunLoop.retrieveMessages(InboundMessagingClient.java:1121)
at com.genesyslab.icc.emailserver.InboundMessagingClient$SessionRunLoop.run(InboundMessagingClient.java:993)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at com.genesyslab.util.concurrent16.NamedThreadFactory$1.run(NamedThreadFactory.java:55)
at java.lang.Thread.run(Thread.java:745)
Caused by: javax.net.ssl.SSLException: Unable to establish handshake using SSL - server may be expecting plain text connection
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:245)
at com.sun.mail.iap.Protocol.(Protocol.java:116)
at com.sun.mail.imap.protocol.IMAPProtocol.(IMAPProtocol.java:121)
at com.sun.mail.imap.IMAPStore.newIMAPProtocol(IMAPStore.java:710)
at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:659)
… 8 more
Enable debug logging on IMAP box level (on ESJ) to see what happens within the IMAP communication, afterthat you would be able to recognize what options have to be added
Cavagnaro, hello. Can you please re-upload the files? The link has expired i think.
I am facing the same issue and i have spent a day trying to figure it out.
Well, it seems that I’m also running into this issue… cavagnaro, do you still have those notes?
23:25:37.214 Std 25080 [SvcSrvW-44] <322> Exception message: Connnection to SMTP Server host 'smtp.office365.com', port 587 failed..
23:25:37.214 Trc 25097 [SvcSrvW-44] <322> Response:
Id=322
Type=Fault
AppName=DEMO_ESJ
AppType=EMAIL_SERVER
Service=Email
Method=Send.
23:25:37.230 Trc 25098 [SvcSrvW-44] <322> 'Email.Send' (request id 322) handling duration : 204 ms.
23:25:37.230 Std 29997 [SvcSrvW-47] <323 023GT72RJ02FC003> javax.net.ssl.SSLException: Unable to establish handshake using SSL - server may be expecting plain text connection
It’s late, i’ll try tomorrow the following instructions from the deployment guide, Andrei Stanciu, you tried it ?
Prerequisites:
• The .truststore file has been created.
Open JavaEmailServerDriver.ini in a text editor.
In the [JavaArgs] section, add the following: -
Djavax.net.ssl.trustStore=
Save and close the file.
Configuring the Corporate E-mail Server Configure TLS/SSL in the Corporate E-mail Server. Follow the constructor recommendations
to generate a certificate and configure TLS/SSL on ports POP3, IMAP and SMTP.
The following is an example of generation of a certificate with keytool (keytool is a Java
utility that is available with the JRE. The utility can be found in
<eServices_Install_Dir>/jre/bin for Unix operating systems, and in
<eServices_Install_Dir>\jre\bin for Windows operating systems):
keytool -genkey -v -alias hostname.example.com
-dname “CN=hostname.example.com,OU=IT,O=ourcompany,C=FR” -keypass
<certificate_password>
-keystore <certicate_name>.keystore -storepass <certificate_password>
-keyalg “RSA” -sigalg “SHA1withRSA” -keysize 2048 -validity 3650
The arguments used in this command are the following:
• -alias—Defines an alias in keystore, to store the key.
• -dname—Distinguished Name, a comma-separated list made up of the following, in
the following order:
◦ CN—Common Name. This must be the name of the host where the corporate e-mail server is running. It must be the host name used in E-mail Server’s settings; for example, if connecting to a POP 3 server, the option server in the pop-client section must have this value.
◦ OU—Organizational Unit Name
◦ O—Organization Name
◦ L—Locality Name (city)
◦ S—State
◦ C—Country Name
-keypass—Password of the key of the certificate.
• -keystore—Specifies the keystore used.
• -storepass—Password of the keystore.
• -keyalg—Algorithm used to generate the key. Possible values are DSA and RSA. More
information is available at http://docs.oracle.com/javase.
• -sigalg—Specifies the algorithm used to sign the key.
• -keysize—Specifies the size of the key.
• -validity—Defines the validity of the certificate, in days. The value in the example is
3,650 days, or 10 years.
By the way, I searched for a long time the “famous” keytool, and it’s under the JDK folder of java, for example ;
C:\Program Files\Java\jdk1.8.0_65\bin\keytool.exe