Last change
on this file since 194 was
194,
checked in by nanardon, 15 years ago
|
- clearly separate Catalyst Model and Vote::DB module, making test faster
|
File size:
1.1 KB
|
Line | |
---|
1 | package Vote::View::Mail; |
---|
2 | |
---|
3 | use strict; |
---|
4 | use base 'Catalyst::View::TT'; |
---|
5 | use Mail::Mailer; |
---|
6 | use Vote::DB; |
---|
7 | |
---|
8 | __PACKAGE__->config( |
---|
9 | TEMPLATE_EXTENSION => '.tt', |
---|
10 | INCLUDE_PATH => Vote->path_to( 'root', 'mail' ), |
---|
11 | PLUGIN_BASE => 'Vote::Template::Plugin', |
---|
12 | ); |
---|
13 | |
---|
14 | =head1 NAME |
---|
15 | |
---|
16 | Vote::View::TT - TT View for Vote |
---|
17 | |
---|
18 | =head1 DESCRIPTION |
---|
19 | |
---|
20 | TT View for Vote. |
---|
21 | |
---|
22 | =cut |
---|
23 | |
---|
24 | sub render { |
---|
25 | my ($self, $c, $template, $args) = @_; |
---|
26 | |
---|
27 | $ENV{MAILADDRESS} = $args->{From}; |
---|
28 | my $mailer = new Mail::Mailer 'smtp', Server => (Vote->config->{smtp} || 'localhost'); |
---|
29 | $mailer->open({ |
---|
30 | (map { $_ => $args->{$_} } grep { $_ !~ /^(mail)$/ } keys %{ $args || {}}), |
---|
31 | 'Content-Type' => 'text/plain; charset=UTF-8; format=flowed', |
---|
32 | 'Content-Transfer-Encoding' => '8bit', |
---|
33 | 'X-Epoll-version' => $Vote::DB::VERSION, |
---|
34 | }); |
---|
35 | print $mailer |
---|
36 | Catalyst::View::TT::render($self, $c, $template, { %{ $args->{mail} || {} }, c => $c }); |
---|
37 | $mailer->close; |
---|
38 | } |
---|
39 | |
---|
40 | =head1 SEE ALSO |
---|
41 | |
---|
42 | L<Vote> |
---|
43 | |
---|
44 | =head1 AUTHOR |
---|
45 | |
---|
46 | Thauvin Olivier |
---|
47 | |
---|
48 | =head1 LICENSE |
---|
49 | |
---|
50 | This library is free software, you can redistribute it and/or modify |
---|
51 | it under the same terms as Perl itself or CeCILL. |
---|
52 | |
---|
53 | =cut |
---|
54 | |
---|
55 | 1; |
---|
Note: See
TracBrowser
for help on using the repository browser.