[Catalyst] Sending email from Catalyst and scripts

Wade.Stuart at fallon.com Wade.Stuart at fallon.com
Wed May 23 14:20:01 GMT 2007







Chisel Wright <chisel at herlpacker.co.uk> wrote on 05/23/2007 04:32:31 AM:

> On Wed, May 23, 2007 at 07:41:21AM +0100, Mark Zealey wrote:
> > Why can you not do something like $c->stash->{emails_to_send} and then
just
> > fire them off in the end() action after the page has been returned to
the
> > remote browser?
> >
>
> Because I don't want to spend any longer between *click* and "page
> loaded" than I have to.
> I feel happier having a queue of emails that I can process at my
> leisure.
>
> I don't have any benchmarking or test cases to show that my way is
> better, or faster - but I'm not claiming this. It's Just The Way I Do It
> and it makes me feel more comfortable with the process.

I do,  I have run backends for websites that send massive amounts of "send
to a friend" mailers.  These messages are user initiated and the way we
have found to be the most optimal in the past is to do the following:

* Insert the information into a queue (we typically use a database table).
* Run a periodic poller on that database that generates the email (the
period on the poller is determined by how long is an acceptable delay for
your app,  many times we use 5 -> 15 minutes).
* Deliver email to a queue and push email server -- this further maximizes
the effect.

In our typical usage scenario a person will send 1 -> 10 emails to friends
at the same domain.  This batching process not only takes the load off the
webapp,  but also allows the SMTP server to multisend to the recipient
domain's MX server very much more frequently.  This can reduce the load on
the queue server substantially depending on the pattern of generated mail
recipients.

-Wade





More information about the Catalyst mailing list