Hello,
I need some help with a JavaMail API problem.
I'm working on a
J2EE app, which can be configured to send mails on certain events. There's a page where the user needs to specify the SMTP server and optionally the username and password if the SMTP server requires authentication. Now, the requirement is that when the user enters this information and clicks on Save, the system should validate whether the values entered are valid or not and display an error message in case of invalid data.
I created a standalone program first which works fine. However, when I put that code in the application, i get an exception.
Here's the standalone program:
Now, the method i'm using in my application is exactly the same as the go() method above except how the messages get displayed to the user.
But i'm always gettting MessagingException, even when I've entered the correct values for SMTP server, user and password.
Here's the error message i'm getting:
2009-12-17 16:41:16,112 DEBUG [com.inmedius.mentor.ui.browser.ServerBean] [admin - ServerConfigurationController]: javax.mail.MessagingException: Exception reading response;
nested exception is:
java.net.SocketException: Connection reset
at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1925)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1684)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:525)
at javax.mail.Service.connect(Service.java:291)
at javax.mail.Service.connect(Service.java:172)
at javax.mail.Service.connect(Service.java:121)
at com.inmedius.mentor.ui.browser.controller.ServerConfigurationController.validateSmtpConnection(ServerConfigurationController.java:715)
............
............
Could anyone please guide me regarding where the problem could be? I'm pretty inexperienced with JavaMail. I have gone through the JavaMail FAQ but didn't find anything that could help me in this case. If I missed something, please point it out. Thanks a lot.