tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sexton, George" <gsex...@mhsoftware.com>
Subject RE: help requested - javax.mail.SendFailedException: intermittently
Date Wed, 26 Jun 2002 15:13:40 GMT
One thing that can intermittently cause problems is a broken SMTP server
that requires IDENTD or auth.

You might make sure that identd is enabled and not blocked by a firewall.

George Sexton
MH Software, Inc.
Voice: 303 438 9585
http://www.mhsoftware.com


-----Original Message-----
From: Rob Cartier [mailto:rcartier@snet.net]
Sent: 26 June, 2002 8:53 AM
To: tomcat-user@jakarta.apache.org
Subject: help requested - javax.mail.SendFailedException: intermittently


I am running tomcat 4.0.2 and jdk 1.4  on RedHat 7.2
and every so often  this peice of code

import java.io.*;
import java.util.*;
import javax.mail.*;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import javax.servlet.*;
import javax.servlet.http.*;

public class MailPremierApplication extends HttpServlet
{

    public MailPremierApplication()
    {
    }

    public void doPost(HttpServletRequest request, HttpServletResponse
response)
        throws IOException, ServletException
    {
		....
		....

        PrintWriter writer = response.getWriter();
        response.setContentType("text/html");
        writer.println("<html>");
        writer.println("<head>");
        writer.println("<title>Mail Sending Results</title>");
        writer.println("</head>");
        writer.println("<body bgcolor=\"white\">");
	try
        {
            Properties props = new Properties();
            props.put("xxxxxx", "xxxxx.com");
            Session mailConnection = Session.getInstance(props, null);
            Message msg = new MimeMessage(mailConnection);
            javax.mail.Address to_whom = new InternetAddress(to);
            javax.mail.Address from_who = new InternetAddress(from);
            msg.setContent(full_msg, "text/plain");
            msg.setFrom(from_who);
            msg.setRecipient(javax.mail.Message.RecipientType.TO, to_whom);
            msg.setSubject(subject);
            Transport.send(msg);
            writer.println("<strong>Message successfully sent!</strong>");
        }
        catch(Throwable t)
        {
            writer.println("<font color=\"red\">");
            writer.println("ENCOUNTERED EXCEPTION:  " + t);
            writer.println("<pre>");
            System.out.println("ENCOUNTERED EXCEPTION:  " + t);
            t.printStackTrace(writer);
            writer.println("</pre>");
            writer.println("</font>");
            writer.println("</body>");
            writer.println("</html>");

        }


generates an error occasionally

ENCOUNTERED EXCEPTION:  javax.mail.SendFailedException: Sending failed;
  nested exception is:
	javax.mail.MessagingException: Could not connect to SMTP host: xxxxxx.com,
port: 25;
  nested exception is:
	java.net.ConnectException: Connection refused


In order to fix this I need to restart tomcat and all is once again ok.

Any and all ideas are welcome


Robert Cartier
112 Fieldbrook Rd
Middletown, Ct. 06457-1746





--
To unsubscribe, e-mail:
<mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-help@jakarta.apache.org>


--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message