1 package # Hide from PAUSE
2 TestApp::Controller::Root;
4 use base qw(Catalyst::Controller);
8 sub default : Private {
11 $c->res->body(qq{Nothing Here});
14 sub email : Global('email') {
15 my ($self, $c, @args) = @_;
17 my $time = $c->req->params->{time} || time;
19 $c->stash->{email} = {
20 to => 'test-email@example.com',
21 from => 'no-reply@example.com',
22 subject => 'Email Test',
23 body => "Email Sent at: $time"
26 $c->forward('TestApp::View::Email');
28 if ( scalar( @{ $c->error } ) ) {
30 $c->res->body('Email Failed');
32 $c->res->body('Plain Email Ok');
36 sub email_app_config : Global('email_app_config') {
37 my ($self, $c, @args) = @_;
39 my $time = $c->req->params->{time} || time;
41 $c->stash->{email} = {
42 to => 'test-email@example.com',
43 from => 'no-reply@example.com',
44 subject => 'Email Test',
45 body => "Email Sent at: $time"
48 $c->forward('TestApp::View::Email::AppConfig');
50 if ( scalar( @{ $c->error } ) ) {
52 $c->res->body('Email Failed');
54 $c->res->body('Plain Email Ok');
58 sub template_email : Global('template_email') {
59 my ($self, $c, @args) = @_;
61 $c->stash->{time} = $c->req->params->{time} || time;
63 $c->stash->{email} = {
64 to => 'test-email@example.com',
65 from => 'no-reply@example.com',
66 subject => 'Just a test',
67 content_type => 'multipart/alternative',
70 template => 'text_plain/test.tt',
71 content_type => 'text/plain',
75 template => 'text_html/test.tt',
76 content_type => 'text/html',
81 $c->forward('TestApp::View::Email::Template');
83 if ( scalar( @{ $c->error } ) ) {
85 $c->res->body('Template Email Failed');
87 $c->res->body('Template Email Ok');
91 sub template_email_single : Global('template_email_single') {
92 my ($self, $c, @args) = @_;
94 $c->stash->{time} = $c->req->params->{time} || time;
96 $c->stash->{email} = {
97 to => 'test-email@example.com',
98 from => 'no-reply@example.com',
99 subject => 'Just a test',
100 content_type => 'multipart/alternative',
103 template => 'text_html/test.tt',
104 content_type => 'text/html',
109 $c->forward('TestApp::View::Email::Template');
111 if ( scalar( @{ $c->error } ) ) {
112 $c->res->status(500);
113 $c->res->body('Template Email Failed');
115 $c->res->body('Template Email Ok');
119 sub template_email_utf8 : Global('template_email_utf8') {
120 my ($self, $c, @args) = @_;
122 $c->stash->{time} = $c->req->params->{time} || time;
124 $c->stash->{chars} = decode('utf-8', "✔ ✈ ✉");
126 $c->stash->{email} = {
127 to => 'test-email@example.com',
128 from => 'no-reply@example.com',
129 subject => 'Just a test',
130 content_type => 'multipart/alternative',
133 template => 'text_plain/test.tt',
134 content_type => 'text/plain',
136 encoding => 'quoted-printable',
140 template => 'text_html/test_utf8.tt',
141 content_type => 'text/html',
143 encoding => 'quoted-printable',
148 $c->forward('TestApp::View::Email::Template');
150 if ( scalar( @{ $c->error } ) ) {
151 $c->res->status(500);
152 $c->res->body('Template Email Failed');
154 $c->res->body('Template Email Ok');
160 sub template_email_app_config : Global('template_email_app_config') {
161 my ($self, $c, @args) = @_;
163 $c->stash->{time} = $c->req->params->{time} || time;
165 $c->stash->{template_email} = {
166 to => 'test-email@example.com',
167 from => 'no-reply@example.com',
168 subject => 'Just a test',
171 template => 'text_plain/test.tt',
172 content_type => 'text/plain',
176 template => 'text_html/test.tt',
177 content_type => 'text/html',
182 $c->forward('TestApp::View::Email::Template::AppConfig');
184 if ( scalar( @{ $c->error } ) ) {
185 $c->res->status(500);
186 $c->res->body('Template Email Failed');
188 $c->res->body('Template Email Ok');
192 sub mason_email : Global('mason_email') {
193 my ($self, $c, @args) = @_;
195 $c->stash->{time} = $c->req->params->{time} || time;
197 $c->stash->{email} = {
198 to => 'test-email@example.com',
199 from => 'no-reply@example.com',
200 subject => 'Just a test',
204 template => 'text_plain/test.m',
205 content_type => 'text/plain',
209 template => 'text_html/test.m',
210 content_type => 'text/html',
215 $c->forward('TestApp::View::Email::Template');
217 if ( scalar( @{ $c->error } ) ) {
218 $c->res->status(500);
219 $c->res->body('Mason Email Failed');
221 $c->res->body('Mason Email Ok');