I’m trying to read a pop3 mailbox using SSL, i’ve got it working on my developer in both a sample solution and in the main solution.
But when I upload the solutions to our production server I get a connection refused error.
This is the code of my test function:
var _mail_prop = []
_mail_prop[0] = 'mail.pop3.host='+ _server;
_mail_prop[1] = 'mail.pop3.ssl.enable=true';
_mail_prop[2] = 'mail.pop3.port='+ _port;
_mail_prop[3] = 'mail.pop3.auth=true';
_mail_prop[4] = 'mail.pop3.user='+_login;
//Receive mails from pop3 account.
application.output(_mail_prop);
try{
var _msgs = plugins.mail.receiveMail( _login, _pwd, true, 0, null, _mail_prop)
if (_msgs != null) //if is null error occurred!
{
application.output(_msgs.length + " messages in mailbox ", LOGGINGLEVEL.INFO)
} else {
application.output("Error connecting to POP account ", LOGGINGLEVEL.DEBUG)
}
}catch(E){
application.output(E.message)
}
Error:
javax.mail.MessagingException: Connect failed;
nested exception is:
java.net.ConnectException: Connection refused: connect
at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:210)
at javax.mail.Service.connect(Service.java:295)
at javax.mail.Service.connect(Service.java:176)
at com.servoy.extensions.plugins.mail.MailServer.receiveMail(MailServer.java:394)
at com.servoy.extensions.plugins.mail.client.MailProvider.receiveMail(MailProvider.java:297)
at com.servoy.extensions.plugins.mail.client.MailProvider.js_receiveMail(MailProvider.java:278)
at sun.reflect.GeneratedMethodAccessor489.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:179)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:367)
at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3666)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2680)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:166)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:387)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3135)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:165)
at com.servoy.j2db.scripting.ScriptEngine.executeFunction(ScriptEngine.java:537)
at com.servoy.j2db.plugins.ClientPluginAccessProvider$MethodExecutor.run(ClientPluginAccessProvider.java:514)
at com.servoy.j2db.server.headlessclient.SessionClient.invokeAndWait(SessionClient.java:1209)
at com.servoy.j2db.server.headlessclient.SessionClient.invokeLater(SessionClient.java:1199)
at com.servoy.j2db.plugins.ClientPluginAccessProvider$1.run(ClientPluginAccessProvider.java:441)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:288)
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:231)
at com.sun.mail.pop3.Protocol.(Protocol.java:107)
at com.sun.mail.pop3.POP3Store.getPort(POP3Store.java:261)
at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:206)
… 24 more
The mailbox is available from any ip address according to the customer and our server provider tells me that the server should be able to connect through the ssl-port.
Can anybody see what i’m doing wrong here? I’m lost and i’ve got an angry customer asking me why this isn’t working.
I’m not sure what response i’m supposed to get. When I enter that into a command prompt, I get a black windows with a blinking cursor and after a while the prompt returns.
This happens for both the googlemail and my customer server.
I’ve uploaded the test solution to a testserver on my local domain (which is 6.1 not 6.0 as the production server) I get the same error: connection refused
yes that means indeed the port 995 is not blocked, and you have access to that domain and port.
Are you doing this in smart-client or web-client?
if in smart-client, you could try to test it in web-client, because that has a different way of class loading…
what you also could try is testing this with a gmail acount (be sure pop3 is enabled) what happens than?
Tried with gmail account, but same results:
it works in my developer
it does not work on the production server, my local test server (tested both web- and smartclient)
After a restart of the server the problem seemed to be gone. I was able to read the email box for a couple of weeks.
But now the problem is back again:
My development machine can access the mailbox, but the server gets the same error again:
javax.mail.MessagingException: Connect failed;
nested exception is:
java.net.ConnectException: Connection refused: connect
at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:210)
at javax.mail.Service.connect(Service.java:295)
at javax.mail.Service.connect(Service.java:176)
at com.servoy.extensions.plugins.mail.MailServer.receiveMail(MailServer.java:394)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:288)
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:231)
at com.sun.mail.pop3.Protocol.<init>(Protocol.java:107)
at com.sun.mail.pop3.POP3Store.getPort(POP3Store.java:261)
at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:206)
... 17 more
Has anybody got any suggestions for me on how to permanently fix this problem?
if nothing has changed, something is going on with your email-server.
are there not any ban-restrictions (too many connections? too many wrong login’s ) that has banned the ip-address of your server?
I’ll ask if this can be an issue.
However I think it is not, because I can replicate the problem on my test server while I don’t have an issue on my development machine. Both the test server and development machine access the web through the same IP. So I would expect neither of them to be able to connect
when I try to read the mailbox using outlook express I get a Certificate warning. When I have accepted the warning (one time only) OE can read the mailbox.
Can this be a reason why the plugin cannot access the mailbox?