X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FView%2FEmail.pm;h=e4be27c6fb35216c3bdb2655e2ead2514eece671;hb=67a0faa44da36360671637daf3896a8cb58eb3a7;hp=fe9afcac50371036072b82c5d1ad00a291650342;hpb=25650747028b09cc100f79d4f456584ca7dc182c;p=catagits%2FCatalyst-View-Email.git diff --git a/lib/Catalyst/View/Email.pm b/lib/Catalyst/View/Email.pm index fe9afca..e4be27c 100644 --- a/lib/Catalyst/View/Email.pm +++ b/lib/Catalyst/View/Email.pm @@ -11,9 +11,9 @@ use Email::MIME::Creator; use base qw|Catalyst::View|; -our $VERSION = '0.02'; +our $VERSION = '0.04'; -__PACKAGE__->mk_accessors('mailer'); +__PACKAGE__->mk_accessors(qw(sender stash_key content_type mailer)); =head1 NAME @@ -112,11 +112,10 @@ sub new { my $self = shift->next::method(@_); my ( $c, $arguments ) = @_; - $self->config($arguments); my $mailer = Email::Send->new; - if ( my $method = $self->config->{sender}->{method} ) { + if ( my $method = $self->sender->{method} ) { croak "$method is not supported, see Email::Send" unless $mailer->mailer_available($method); $mailer->mailer($method); @@ -127,8 +126,8 @@ sub new { } } - if ( $self->config->{sender}->{mailer_args} ) { - $mailer->mailer_args($self->config->{sender}->{mailer_args}); + if ( $self->sender->{mailer_args} ) { + $mailer->mailer_args($self->sender->{mailer_args}); } $self->mailer($mailer); @@ -142,12 +141,12 @@ sub process { croak "Unable to send mail, bad mail configuration" unless $self->mailer; - my $email = $c->stash->{$self->config->{stash_key}}; + my $email = $c->stash->{$self->stash_key}; croak "Can't send email without a valid email structure" unless $email; - if ( $self->config->{content_type} ) { - $email->{content_type} ||= $self->config->{content_type}; + if ( $self->content_type ) { + $email->{content_type} ||= $self->content_type; } my $header = $email->{header} || []; @@ -200,6 +199,8 @@ J. Shirley (Thanks!) +Matt S Trout + Daniel Westermann-Clark =head1 LICENSE