JavaMail - no problem... found loads of examples. With regards to the canceling of requests, i'm not sure what you're saying - are you saying 1. your code will stop on browser cancels and there's nothing you can do or 2. you're code will always finish running even if the user cancels (tho obviously it wont get displayed)
Comparing this to php, when a browser cancels a request to php, it stops the execution of the script (sometimes...). But, you can add code to make the script complete regardless of wether the user is still there or not. This is what i want to acheive. I cant have the user submitting a request, and then stopping it part way through. Daniel. -----Original Message----- From: James Mitchell [mailto:[EMAIL PROTECTED] Sent: 18 May 2004 17:32 To: Struts Users Mailing List Subject: Re: sending emails from a struts app > I need to send out emails from a struts app. > > Any comments on the best way to go about this? Yes, use JavaMail: http://java.sun.com/products/javamail/ http://www.j2eeolympus.com/J2EE/JavaMail/JavaMail.jsp > > As sending mail can be slow, is there an easy way to do this in the > background? That depends entirely on your requirements. I supposed you could use anything from kicking off another thread [0] to using JMS [1] to queue up some mail process. [0] http://java.sun.com/docs/books/tutorial/essential/threads/ [1] http://www.j2eeolympus.com/J2EE/JMS/JMS.jsp > > What happens if a client cancels a request part way through? is there any > way to handle this / ignore cancels? "part way through".....there's no such animal. Once the page is submitted or a link is clicked, you (server side) have no control over it. At best, the browser may send a disconnect if the user hits the stop button or closes the browser abruptly, but that's not guaranteed and is VERY browser specific. Even if you were lucky enough to dictate the browser and version, you will never see it get past the container. As I have told other people, I would give up on that requirement, unless you want to "roll your own browser" like my current gig is doing[3]. [3] http://www.mozilla.org/unix/customizing.html -- James Mitchell Software Engineer / Open Source Evangelist AIM: jmitchtx --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]