use base qw|Catalyst::View|;
-our $VERSION = '0.08';
+our $VERSION = '0.07';
-__PACKAGE__->mk_accessors(qw(sender stash_key content_type mailer));
+#__PACKAGE__->mk_accessors(qw(sender stash_key content_type mailer));
+__PACKAGE__->mk_accessors(qw(stash_key content_type mailer));
=head1 NAME
stash_key: email
content_type: text/plain
sender:
- method: SMTP
+ mailer: SMTP
# mailer_args is passed directly into Email::Send
mailer_args:
Host: smtp.example.com # defaults to localhost
=cut
__PACKAGE__->config(
- stash_key => 'email',
+ stash_key => 'email',
+ default => {
+ content_type => 'text/html',
+ },
);
=head1 SENDING EMAIL
this as being used by setting up your configuration to look like this:
View::Email:
- default_view: TT
+ default:
+ view: TT
Then, Catalyst::View::Email will forward to your View::TT by default.
my ( $c, $arguments ) = @_;
- my $mailer = Email::Send->new;
+ my $sender = Email::Send->new;
- if ( my $method = $self->sender->{method} ) {
- croak "$method is not supported, see Email::Send"
- unless $mailer->mailer_available($method);
- $mailer->mailer($method);
+ if ( my $mailer = $self->{sender}->{mailer} ) {
+ croak "$mailer is not supported, see Email::Send"
+ unless $sender->mailer_available($mailer);
+ $sender->mailer($mailer);
} else {
# Default case, run through the most likely options first.
for ( qw/SMTP Sendmail Qmail/ ) {
- $mailer->mailer($_) and last if $mailer->mailer_available($_);
+ $sender->mailer($_) and last if $sender->mailer_available($_);
}
}
- if ( my $args = $self->sender->{mailer_args} ) {
+ if ( my $args = $self->{sender}->{mailer_args} ) {
if ( ref $args eq 'HASH' ) {
- $mailer->mailer_args([ %$args ]);
+ $sender->mailer_args([ %$args ]);
}
elsif ( ref $args eq 'ARRAY' ) {
- $mailer->mailer_args($args);
+ $sender->mailer_args($args);
} else {
croak "Invalid mailer_args specified, check pod for Email::Send!";
}
}
- $self->mailer($mailer);
+ $self->mailer($sender);
return $self;
}