Kirk Wylie wrote:
Shyam A wrote:
Hi,
I have a Struts application in which I need to send email notification to a large number of recipients based on a user action. Currently, I use the Java Mail API and send emails from my application. I use a single email with all recipients in the "BCC" field.
Although, this approach works reasonably well for small numbers (around 100), it doesn't seem suitable for mailing very large number of recipients (in the order of 1000's). I'm not sure if the mailing process can be done at the backend with Oracle 9i database, using a stored procedure or a trigger.
What specifically is taking a long time? Is it the generation of the email, or its sending? Because most email servers should make sending such a message quite quick as they're doing the actual caching and sending to multiple recipients.
But in general, you might look into JMS for this type of thing (i.e. some way to "background process" an operation), since it's the standard J2EE way to do asynchronous event management like this.
An alternative which is a little messier, but is probably quicker to do, is to have a thread-based operation which you kick off in your Action class immediately before returning from execute(...). It would then create and send the email. In this case you would return control to the user (who's the one who caused the mass email to kick off) immediately, and background-process the emails. The major problems here are:
1) There are "better" ways to do this (i.e. JMS and/or message driven beans)
2) You're potentially creating a large number of threads if this is happening on a regular basis. But if it is, that's even more reason to use JMS or a commercial bulk emailing system (where bulk != spam)
3) You can't provide immediate feedback to the user about the status of the mail job because it's happening in the background.
4) Because it's not transactional (unlike JMS), you might "lose" the email if there's a failure.
Kirk Wylie M7 Corporation
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- Brice D. Ruth Sr. IT Analyst Fiskars Brands, Inc.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

