[Catalyst] Suggestions for sending email from cron job using'Catalyst' templates?

Peter Edwards peter at dragonstaff.co.uk
Tue Apr 12 01:06:18 GMT 2011

On 12 April 2011 00:50, Charlie Garrison <garrison at zeta.org.au> wrote:

> Good morning,
> On 11/04/11 at 6:58 PM +0300, Octavian Rasnita <orasnita at gmail.com> wrote:
>  The TT templates used by the Catalyst app might contain many things
>> like c.user, c.uri_for_action, may display images, may depend on other
>> templates which are loaded automaticly when those templates are
>> specified in the app config file. So there is no sane way of using
>> those wrapper templates for sending email from a cron job.
> That was the conclusion I was reaching; I wanted feedback from others
> before I tried to make my own garden path.

Put the logic in a model class that reads a config shared with but
independent from your controller so you can run it outside of Catalyst.
This article outlines how to do this
If you need any web transaction details (c.user etc.) capture them at
request time and put them in an item in a queue (using ActiveMQ or similar).
Then in your cron script step through the queue entries, unpack the details
and do the template merge using TT2 before sending using Mail::Sender or
Email::Stuff or whatever.
You don't really need the Catalyst controller framework up and running to do

Regards, Peter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20110412/c2f77=

More information about the Catalyst mailing list