[Catalyst] Sending email safely with Catalyst

Jonathan Rockway jon at jrock.us
Fri Apr 11 19:37:56 BST 2008


* On Fri, Apr 11 2008, Zbigniew Lukasiak wrote:
> I've got a related question - does anyone send bulk emails with that
> plugin?  Is the delay reasonable when sending let's say a hundred
> emails or do I need a background mechanism for that?  I have now a
> forking solution - but it is a bit complex (and for mod_perl they
> recommend to do it in a 'cleanup' handler instead of a forked
> process).

In an ideal world, you should be able to dump the messages into your
mail system's queue as quickly as you can dump them into a database
table (adding to the mail queue is a disk write, adding to a database is
a disk write, unless you've turned off data integrity).

I could see how calculating the text of 10000 mail messages during a
request would be slow, but why would you want to do that?  Usually
you'll just want to say "Your account was created, [% name %]!" and
queue that.  The template rendering and the mail system's queue should
be more than fast enough to handle that during a request.

As for bulk emails, you probably have a process that calculates those
outside of your Catalyst app anyway (running from cron), so calculate
them, dump them into the mail queue, and let your mailer daemon figure
out what to do.  Much better than putting a queue in front of a queue,
IMHO.  This is UNIX after all.

Regards,
Jonathan Rockway

-- 
print just => another => perl => hacker => if $,=$"



More information about the Catalyst mailing list