send an email using play

Asked by marc

I am trying to use Mail (play.libs.Mail)

In my application.conf I have added:
mail.smtp.host=xxx
mail.smtp.port=23

It seems the parameter mail.smtp.port is not used as I get the error below. The port 25 is used instead of the port 23. What can I do?

A mail error occured : Error while sending email

play.exceptions.MailException: Error while sending email
 at play.libs.Mail$1.run(Mail.java:209)
Caused by: javax.mail.MessagingException: Could not connect to SMTP host: xxx, port: 25;
  nested exception is:
 java.net.ConnectException: Connection timed out
 at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1391)
 at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:412)
 at javax.mail.Service.connect(Service.java:288)
 at javax.mail.Service.connect(Service.java:169)
 at play.libs.Mail$1.run(Mail.java:205)
Caused by: java.net.ConnectException: Connection 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:366)
 at java.net.Socket.connect(Socket.java:519)
 at java.net.Socket.connect(Socket.java:469)
 at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:233)
 at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:189)
 at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1359)
 ... 4 more

Question information

Language:
English Edit question
Status:
Solved
For:
play framework Edit question
Assignee:
No assignee Edit question
Solved by:
Jean-Francois POUX
Solved:
Last query:
Last reply:
Revision history for this message
Jean-Francois POUX (jfp-taldius) said :
#1

Hi,

Which version of play are you using ? We have patched this recently, so could you try to update to a newer version of play ? You may grab a nightly from http://www.playframework.org/download/nightly/.

Revision history for this message
marc (marc-ttux) said :
#2

I am using play-1.0-stable4. The link you gave me for the nightly build, is it stable4 as well?

Revision history for this message
Jean-Francois POUX (jfp-taldius) said :
#3

Hu ho, sorry for the misleading stable-3-rxxx things in there, they are stable-4 in fact. I'll change the build script.

This one should do fine: http://www.playframework.org/download/nightly/play-1.0-stable3-r264.zip.

Revision history for this message
marc (marc-ttux) said :
#4

The 264 seems to be broken. I get this when I start play:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/mina/transport/socket/SocketAcceptor
Caused by: java.lang.ClassNotFoundException: org.apache.mina.transport.socket.SocketAcceptor
 at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
 at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: play.server.Server. Program will exit.

Revision history for this message
Best Jean-Francois POUX (jfp-taldius) said :
#5

Hi,

That's strange. Got no problem with that file yesterday at home, but this morning the server hosting playframework.org provides corrupted archives sometimes.... While we fix the problem, you can try here: http://people.zenexity.fr/~jfp/play-builds/

Regards

Revision history for this message
marc (marc-ttux) said :
#6

Thanks Jean-Francois POUX, that solved my question.