Yes. Create a class for sending emails that has it's own thread. Have it look at some data structure to get a mail message object to be sent and wait for as long as there are no mails to be sent.
In your servlet have it create a mail object and give it to the mail sending class. This way sending mail only requires putting a mail object onto some datastructure from the perspective of the servlet. Then it returns. You can't of course know whether the mail was sent succesfully or not but that's the trade off. d. Richard Johnstone wrote:
Hi I am currently sending a mail from within a servlet. The problem is that it "hangs" the page for ages as it churns away sending the mail. Is there anyway to execute a method in the background, so effectively it calls something which churns away but control is returned back to the servlet straight away? Ta Rich ------------------------------------------------------------------------ The information contained in this communication is intended solely for the use of the individual or entity to whom it is addressed and others authorized to receive it. It may contain confidential or legally privileged information. If you are not the intended recipient you are hereby notified that any disclosure, copying, distribution or taking any action in reliance on the contents of this information is strictly prohibited and may be unlawful. If you received this communication in error, please notify us immediately by responding to this email and then delete it from your system. Appleyard Finance Holdings Ltd or its subsidiaries are neither liable for the proper and complete transmission of the information contained in this communication nor for any delay in its receipt.
-- David Mossakowski Instinet Corporation **************************************************************************** <<Disclaimer>> This message is intended only for the use of the Addressee and may contain information that is PRIVILEGED and/or CONFIDENTIAL or both. This email is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this email is not an intended recipient, you have received this email in error and any review, dissemination, distribution or copying is strictly prohibited. If you have received this email in error, please notify the sender immediately by return mail and permanently deleting the copy you received. Thank you. **************************************************************************** ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html