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                   from        => 'no-reply@foobar.com',
52                   subject     => 'I am a Catalyst generated email',
53                   template    => 'test.tt',
54                   content_type => 'multipart/alternative'
55               };
56
57               $c->forward( $c->view('Email::Template') );
58           }
59
60       Alternatively if you want more control over your templates you can use
61       the following idiom to override the defaults. If charset and encoding
62       given, the body become properly encoded.
63
64           templates => [
65               {
66                   template        => 'email/test.html.tt',
67                   content_type    => 'text/html',
68                   charset         => 'utf-8',
69                   encoding        => 'quoted-printable',
70                   view            => 'TT',
71               },
72               {
73                   template        => 'email/test.plain.mason',
74                   content_type    => 'text/plain',
75                   charset         => 'utf-8',
76                   encoding        => 'quoted-printable',
77                   view            => 'Mason',
78               }
79           ]
80

HANDLING ERRORS

82       See "HANDLING ERRORS" in Catalyst::View::Email.
83

METHODS

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

TODO

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

SEE ALSO

112   Catalyst::View::Email - Send plain boring emails with Catalyst
113   Catalyst::Manual - The Catalyst Manual
114   Catalyst::Manual::Cookbook - The Catalyst Cookbook

AUTHORS

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

LICENSE

123       This library is free software, you can redistribute it and/or modify it
124       under the same terms as Perl itself.
125
126
127
128perl v5.32.0                      2020-07-28Catalyst::View::Email::Template(3)
Impressum