But when I upload the solutions to our production server I get a connection refused error.
This is the code of my test function:
- Code: Select all
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.<init>(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.