So, to clarify - is the mail-sending slow waiting for the mail server to return with a 250 - OK response, or is creating the mail message to send (with all the BCC: addresses), before sending it over to the server, slow? The point being - in theory, the mail server should bear the brunt of the time of sending the message out to the recipients, unless it is hanging on to the connection you've opened, until it has sent to all recipients, before returning with the 250-OK message, indicating that everything was successful.

If that's the case, you might consider sending through a different SMTP server, one that doesn't block on that ... and just accepts the message for delivery instantaneously.

Shyam A wrote:

Kirk,

Thanks a lot for your suggestions. I will look into
JMS.
In my current approach, the process of sending the
mail is time consuming.I'm concerned that sending an
email to 1000's of recipients from my application
(using JMS, Thread etc) would clog my application
server (OC4J) and slow down its operation, which is
why I was wondering if it could be done at the
backend-Oracle 9i.

Thanks,
Shyam

--- Kirk Wylie <[EMAIL PROTECTED]> 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]





__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

---------------------------------------------------------------------
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]



Reply via email to