# Get mail with mail.receiveMail

**URL:** <https://forum.servoy.com/t/get-mail-with-mail-receivemail/13439>\
**Category:** Classic Servoy\
**Created:** [January 12, 2011, 1:04pm UTC](https://forum.servoy.com/t/get-mail-with-mail-receivemail/13439 "2011-01-12T13:04:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![victor.rojo](https://avatars.discourse-cdn.com/v4/letter/v/57b2e6/32.png) [@victor.rojo](https://forum.servoy.com/u/victor.rojo)\
**Post date:** [January 12, 2011, 1:04pm UTC](https://forum.servoy.com/t/get-mail-with-mail-receivemail/13439/1 "2011-01-12T13:04:07Z")

</div>

Hi.  
I’m trying to get my mail with the mail plugin but I can´t get it. In the log I found timed out exceptions:

```auto
avax.mail.MessagingException: Connect failed; nested exception is: java.net.ConnectException: Operation timed out 
    	at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:161) 
    	at javax.mail.Service.connect(Service.java:288) 
    	at javax.mail.Service.connect(Service.java:169) 
    	at com.servoy.extensions.plugins.mail.MailServer.receiveMail(Unknown Source) 
    	at com.servoy.extensions.plugins.mail.MailProvider.js_receiveMail(Unknown Source) 
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
    	at java.lang.reflect.Method.invoke(Method.java:597) 
    	at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:179) 
    	at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:353) 
    	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:3127) 
    	at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:165) 
    	at com.servoy.j2db.scripting.ScriptEngine.executeFunction(ScriptEngine.java:458) 
    	at com.servoy.j2db.debug.RemoteDebugScriptEngine.executeFunction(RemoteDebugScriptEngine.java:382) 
    	at com.servoy.j2db.FormController.executeFunction(FormController.java:3977) 
    	at com.servoy.j2db.FormController.executeFormMethod(FormController.java:4291) 
    	at com.servoy.j2db.FormController.executeOnShowMethod(FormController.java:4170) 
    	at com.servoy.j2db.FormController.access$15(FormController.java:4161) 
    	at com.servoy.j2db.FormController$3.run(FormController.java:3040) 
    	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209) 
    	at com.servoy.j2db.util.SwingHelper.dispatchEvents(SwingHelper.java:153) 
    	at com.servoy.j2db.smart.J2DBClient$24.run(J2DBClient.java:2964) 
    	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209) 
    	at java.awt.EventQueue.dispatchEvent(EventQueue.java:633) 
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296) 
    	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211) 
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201) 
    	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196) 
    	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188) 
    	at java.awt.EventDispatchThread.run(EventDispatchThread.java:122) 
    Caused by: java.net.ConnectException: Operation timed out 
    	at java.net.PlainSocketImpl.socketConnect(Native Method) 
    	at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333) 
    	at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195) 
    	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182) 
    	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:432) 
    	at java.net.Socket.connect(Socket.java:529) 
    	at java.net.Socket.connect(Socket.java:478) 
    	at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:233) 
    	at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:189) 
    	at com.sun.mail.pop3.Protocol.<init>(Protocol.java:94) 
    	at com.sun.mail.pop3.POP3Store.getPort(POP3Store.java:214) 
    	at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:157) 
    	... 34 more

```

am I forgetting something?

```auto
var properties = new Array()
properties[0] = 'mail.pop3.host=pop.gmail.com';
properties[1] = 'mail.pop3.port=995';

var msgs = plugins.mail.receiveMail('account@gmail.com', 'password', true, 0, null, properties);

```

And yes I have enabled POP in the gmail configuration.  
Thanks in advance.

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [January 13, 2011, 8:29am UTC](https://forum.servoy.com/t/get-mail-with-mail-receivemail/13439/2 "2011-01-13T08:29:13Z")

</div>

you connect with plain sockets but you need ssl (secure) connection:

[http://forum.servoy.com/viewtopic.php?f … it=ssl+pop](http://forum.servoy.com/viewtopic.php?f=15&t=8120&hilit=ssl+pop)

---

<div class="post-metadata">

**Author:** ![victor.rojo](https://avatars.discourse-cdn.com/v4/letter/v/57b2e6/32.png) [@victor.rojo](https://forum.servoy.com/u/victor.rojo)\
**Post date:** [January 13, 2011, 10:28am UTC](https://forum.servoy.com/t/get-mail-with-mail-receivemail/13439/3 "2011-01-13T10:28:10Z")

</div>

I thought so but I couldn’t make it work.  
I tried some properties:

```auto
var properties = new Array()
properties[0] = 'mail.pop3.host=pop.gmail.com';
properties[1] = 'mail.pop3.port=995';
properties[2] = 'mail.pop3.ssl.enable=true';

```

```auto
var properties = new Array()
properties[0] = 'mail.pop3.host=pop.gmail.com';
properties[1] = 'mail.pop3.socketFactory.class=javax.net.ssl.SSLSocketFactory';
properties[2] = 'mail.pop3.socketFactory.fallback=false';
properties[3] = 'mail.pop3.port=995';
properties[4] = 'mail.pop3.socketFactory.port=995';

```

Does anybody know the properties to make it work (in the sample code only use the mail.pop3.host property)?
