Java Mail : Help plz
Hi ,
I'm trying to send a mail to gmail account using java mail from the servlet.
i set the propertieshost.name=smtp.gmail.com
and havingcode in doPost like
public void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
// first, set the "content type" header of the response
res.setContentType("text/html");
// Get the response's PrintWriter to return text to the client.
PrintWriter toClient = res.getWriter();
try {
String toText = req.getParameter("to");
String fromText = req.getParameter("from");
String subjectText = req.getParameter("subject");
String contentText = req.getParameter("content");
SendMessage.send(toText, fromText, subjectText, contentText);
// Respond to client with a confirmation
toClient.println("<html>");
toClient.println("<title>Thank you!</title>");
toClient.println("<body bgcolor=#ffffff>
<img src=images/BEA_Button_Final_web.gif align=right>" +
"<font face=\"Helvetica\">" + "Your message has been sent</font></body>");
toClient.println("</html>");
} catch(Exception e) {
e.printStackTrace();
toClient.println("A problem occured while sending Mail. Here is the exception: " + e);
}
this shows the exception "A problem occured while sending Mail. Here is the exception: javax.mail.MessagingException: Exception reading response; nested exception is: java.net.SocketException: Connection reset "
plz help
thanks in advance

