java - Javamail smtp connect & Domino Lotus -
i've developed web application (jsf, spring, jboss 7.0.13) sending mails on smtp using javamail 1.4 , domino lotus 9.0.1 mailing server.
what's done :
- domino lotus configured allow smtp messages.
- i can send mails using lotus notes (mailing client).
- i can send mails using simple clients (simple jar files i've developed testing purpose).
send method source code :
system.out.println(" ******************* start sending email ***********************"); properties props = new properties(); session session = session.getdefaultinstance(props, null); session.setdebug(true); props.put("mail.smtp.host", "192.168.25.5"); props.put("mail.smtp.socketfactory.port","25"); props.put("mail.smtp.port", "25"); session = session.getinstance(props); try { message message; message = new mimemessage(session); message.setfrom(new internetaddress("alice@test.ma")); message.setrecipients(message.recipienttype.to, internetaddress.parse("bob@test.ma")); message.setsubject("test notification"); message.setcontent("hello there !!", "text/html"); transport.send(message); } catch (messagingexception e) { throw new runtimeexception(e); } system.out.println(" ******************* end sending mail ***********************"); }
what's strange using same method in simple java application can send mails without problem but,when trying send mails web application, , of course using same method source code again >>> got exception :
caused by: javax.mail.messagingexception: not connect smtp host: 192.168.25.5, port: 25; nested exception is: java.net.socketexception: unrecognized windows sockets error: 10107: connect @ com.sun.mail.smtp.smtptransport.openserver(smtptransport.java:1934) [mail-1.4.4.jar:1.4.4] @ com.sun.mail.smtp.smtptransport.protocolconnect(smtptransport.java:638) [mail-1.4.4.jar:1.4.4] @ javax.mail.service.connect(service.java:295) [mail-1.4.4.jar:1.4.4] @ javax.mail.service.connect(service.java:176) [mail-1.4.4.jar:1.4.4] @ javax.mail.service.connect(service.java:125) [mail-1.4.4.jar:1.4.4] @ javax.mail.transport.send0(transport.java:194) [mail-1.4.4.jar:1.4.4] @ javax.mail.transport.send(transport.java:124) [mail-1.4.4.jar:1.4.4] ... 83 more caused by: java.net.socketexception: unrecognized windows sockets error: 10107: connect @ java.net.twostacksplainsocketimpl.socketconnect(native method) [rt.jar:1.7.0_55] @ java.net.abstractplainsocketimpl.doconnect(abstractplainsocketimpl.java:339) [rt.jar:1.7.0_55] @ java.net.abstractplainsocketimpl.connecttoaddress(abstractplainsocketimpl.java:200) [rt.jar:1.7.0_55] @ java.net.abstractplainsocketimpl.connect(abstractplainsocketimpl.java:182) [rt.jar:1.7.0_55] @ java.net.plainsocketimpl.connect(plainsocketimpl.java:172) [rt.jar:1.7.0_55] @ java.net.sockssocketimpl.connect(sockssocketimpl.java:392) [rt.jar:1.7.0_55] @ java.net.socket.connect(socket.java:579) [rt.jar:1.7.0_55] @ java.net.socket.connect(socket.java:528) [rt.jar:1.7.0_55] @ com.sun.mail.util.socketfetcher.createsocket(socketfetcher.java:288) [mail-1.4.4.jar:1.4.4] @ com.sun.mail.util.socketfetcher.getsocket(socketfetcher.java:231) [mail-1.4.4.jar:1.4.4] @ com.sun.mail.smtp.smtptransport.openserver(smtptransport.java:1900) [mail-1.4.4.jar:1.4.4] ... 89 more
other infos :
- domino lotus server ip_adress : 192.168.25.5
- domino lotus smtp default port : 25
- alice , bon mails adresses created.
thanks torsten link, you're right jboss service had not permission allow web application communicate on smtp domino lotus, running jboss manually through standalone.bat solved problem. again =)
Comments
Post a Comment