1Catalyst::View::Email::UTseemrplCaotnet(r3i)buted Perl DCoactuamleynstta:t:iVoinew::Email::Template(3)
2
3
4

NAME

6       Catalyst::View::Email::Template - Send Templated Email from Catalyst
7

SYNOPSIS

9       Sends templated mail, based upon your default view. It captures the
10       output of the rendering path, slurps in based on mime-types and
11       assembles a multi-part email using Email::MIME::Creator and sends it
12       out.
13

CONFIGURATION

15       WARNING: since version 0.10 the configuration options slightly changed!
16
17       Use the helper to create your view:
18
19           $ script/myapp_create.pl view Email::Template Email::Template
20
21       For basic configuration look at "CONFIGURATION" in
22       Catalyst::View::Email.
23
24       In your app configuration (example in YAML):
25
26           View::Email::Template:
27               # Optional prefix to look somewhere under the existing configured
28               # template  paths.
29               # Default: none
30               template_prefix: email
31               # Define the defaults for the mail
32               default:
33                   # Defines the default view used to render the templates.
34                   # If none is specified neither here nor in the stash
35                   # Catalysts default view is used.
36                   # Warning: if you don't tell Catalyst explicit which of your views should
37                   # be its default one, C::V::Email::Template may choose the wrong one!
38                   view: TT
39

SENDING EMAIL

41       Sending email works just like for Catalyst::View::Email but by
42       specifying the template instead of the body and forwarding to your
43       Email::Template view:
44
45           sub controller : Private {
46               my ( $self, $c ) = @_;
47
48               $c->stash->{email} = {
49                   to          => 'jshirley@gmail.com',
50                   cc          => 'abraxxa@cpan.org',
51                   bcc         => 'hidden@secret.com hidden2@foobar.com',
52                   from        => 'no-reply@foobar.com',
53                   subject     => 'I am a Catalyst generated email',
54                   template    => 'test.tt',
55                   content_type => 'multipart/alternative'
56               };
57
58               $c->forward( $c->view('Email::Template') );
59           }
60
61       Alternatively if you want more control over your templates you can use
62       the following idiom to override the defaults:
63
64           templates => [
65               {
66                   template        => 'email/test.html.tt',
67                   content_type    => 'text/html',
68                   charset         => 'utf-8',
69                   view            => 'TT',
70               },
71               {
72                   template        => 'email/test.plain.mason',
73                   content_type    => 'text/plain',
74                   charset         => 'utf-8',
75                   view            => 'Mason',
76               }
77           ]
78

HANDLING ERRORS

80       See "HANDLING ERRORS" in Catalyst::View::Email.
81

METHODS

83       generate_part
84           Generates a MIME part to include in the email. Since the email is
85           template based every template piece is a separate part that is
86           included in the email.
87
88       process
89           The process method is called when the view is dispatched to. This
90           creates the multipart message and then sends the message contents
91           off to Catalyst::View::Email for processing, which in turn hands
92           off to Email::Sender::Simple.
93

TODO

95   ATTACHMENTS
96       There needs to be a method to support attachments.  What I am thinking
97       is something along these lines:
98
99           attachments => [
100               # Set the body to a file handle object, specify content_type and
101               # the file name. (name is what it is sent at, not the file)
102               { body => $fh, name => "foo.pdf", content_type => "application/pdf" },
103               # Or, specify a filename that is added, and hey, encoding!
104               { filename => "foo.gif", name => "foo.gif", content_type => "application/pdf", encoding => "quoted-printable" },
105               # Or, just a path to a file, and do some guesswork for the content type
106               "/path/to/somefile.pdf",
107           ]
108

SEE ALSO

110   Catalyst::View::Email - Send plain boring emails with Catalyst
111   Catalyst::Manual - The Catalyst Manual
112   Catalyst::Manual::Cookbook - The Catalyst Cookbook

AUTHORS

114       J. Shirley <jshirley@gmail.com>
115
116       Simon Elliott <cpan@browsing.co.uk>
117
118       Alexander Hartmaier <abraxxa@cpan.org>
119

LICENSE

121       This library is free software, you can redistribute it and/or modify it
122       under the same terms as Perl itself.
123
124
125
126perl v5.12.0                      2010-05-23Catalyst::View::Email::Template(3)
Impressum