Hi. I'll try to explain my problem, that is about sending an email with 
JavaMail API from a servlet. Anyway, it seems to be a more general problem i'm 
having with servlet. I'm using Tomcat 5.0. I've a servlet that process a 
request, writes to a database some info and then send a email with a summary to 
the user.

In the method sendMail() i send the email. I test the method in isolation and 
it works fine. I can connect to my local smtp server and send the email...
Here's the code:

do some stuff.....and send the email

logInfo("Sending summary email");
        sendMail(summary.toString(),clientEmail);
        response.setStatus(HttpServletResponse.SC_OK);
        logInfo("Email sent");
        }catch(Exception e){
            logError("Error sending summary mail to address: "+clientEmail,e);
            e.printStackTrace();
        }
    }

No exceptions are throwed...but it seems that the servlet doesn't "wait" for 
the method. When i test the method in isolation, it takes some seconds before 
the mail is sent, and in the smtp local server application i can see that a 
connection has been established. 

If i call the same code (the sendMail method) from the servlet i get "Email 
Sent" log messagge immediately and the servlet "exit"..like if the message was 
sent. But nothing has happened (no connection is established with the local 
smtp server) and no exception is thrown..


Anyone can help me?


              
---------------------------------

---------------------------------
L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail

Reply via email to