[Catalyst-dev] RFC: Catalyst::View::Email and Catalyst::View::TemplateEmail

J. Shirley jshirley at gmail.com
Mon Mar 19 22:48:35 GMT 2007


Some discussion with ash in #catalyst revealed that there is a need for a
more modern, up to date, best practice, shiny method for emailing from
within a Catalyst app.

It's been my view for quite some time to do this via a View component, as
Email to me is really just a view.  It just isn't the end point view.  I
have working code that I can modify to make CPANable without too much
effort.  Right now it interacts directly with TT, but I'd like to separate
that behavior out.

Here's how I envision it (based on how my current code functions) --

The config:
MyApp->config('View::Email' =3D> {
    stash_key =3D> 'mail',
    default_types =3D> [ qw(text/plain text/html) ],
    template_root =3D> 'mail', # root/mail
});

In a controller, you populate:

$c->stash->{mail} =3D {
   template =3D> 'registration',
   types      =3D> [ qw(text/plain text/html) ],
};

Then the templates on disk would expected to be:

 root/mail/registration/textplain.tt
 root/mail/registration/texthtml.tt

And finally, forward:
 $c->forward('View::Email');

Emails away.  Alternative syntax is: $c->forward('View::Email', [ $mail_hash
]);

Thoughts?  I think this would be a good module to get out the door, get
standardized and get a cookbook entry on.

I'm volunteering to do the work, considering you guys agree on the methods
for it.  Tests and pod patches would be welcome, though.

Thanks,
-Jay
-- =

J. Shirley :: jshirley at gmail.com :: Killing two stones with one bird...
http://www.toeat.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst-dev/attachments/20070319/e=
9104821/attachment.htm


More information about the Catalyst-dev mailing list