Sorry for my last mail.I just found the culprit.Its my firewall which
blocked all outgoing mails and its none to deal with java.Really sorry..
---------- Forwarded message ----------
From: Lakshmi Narayanan <[EMAIL PROTECTED]>
Date: Apr 17, 2007 5:46 AM
Subject: Mailing Exception in Java!help Needed.....
To: James Users List <[email protected]>
Whenever i try to send a mail using a small basic code in java,it generates
the following exception.
javax.mail.MessagingException: Could not connect to SMTP host:
smtp.mailpro.com , port: 25;
nested exception is:
java.net.SocketException: Software caused connection abort: connect
com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1282)
com.sun.mail.smtp.SMTPTransport.protocolConnect (SMTPTransport.java:370)
javax.mail.Service.connect(Service.java:275)
javax.mail.Service.connect(Service.java:156)
javax.mail.Service.connect(Service.java:105)
javax.mail.Transport.send0(Transport.java:168)
javax.mail.Transport.send(Transport.java:98)
org.apache.jsp.sendmail_jsp._jspService(sendmail_jsp.java:65)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service (HttpServlet.java:810)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java
:298)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service (JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
JAMES is running and all works fine when a sample mail is sent with outlook
instead.So JAMES is not causing this exception.But I desperately want this
code to run and i know this is not a group to ask about java
doubts.Butim rather in a hurry to complete it and thought this list
will answer me better and fast.
Im also adding the code which causes the exception.Its a jsp page.
<%@ page import="java.util.*, javax.mail.*, javax.mail.internet.*" %>
<%
Properties props = new Properties();
props.put("mail.smtp.host", " smtp.mailpro.com");
Session s = Session.getInstance(props,null);
MimeMessage message = new MimeMessage(s);
InternetAddress from = new InternetAddress(" [EMAIL PROTECTED]");
message.setFrom(from);
String toAddress = request.getParameter("to");
InternetAddress to = new InternetAddress(toAddress);
message.addRecipient( Message.RecipientType.TO, to);
String subject = request.getParameter("subject");
message.setSubject(subject);
String text = request.getParameter("text");
message.setText(text);
Transport.send(message);
%>
Any help is really appreciated.....