From: J. Shirley Date: Sat, 19 May 2007 17:21:24 +0000 (+0000) Subject: Changing sender->host to use mailer_args to be more compatible with Email::Send,... X-Git-Tag: v0.14~44 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b3d2ac28347f116ae79fd5055cfff575811d4bef;p=catagits%2FCatalyst-View-Email.git Changing sender->host to use mailer_args to be more compatible with Email::Send, adding raw mailer_args passthrough and two basic tests. --- diff --git a/lib/Catalyst/View/Email.pm b/lib/Catalyst/View/Email.pm index ac41fbc..8098fde 100644 --- a/lib/Catalyst/View/Email.pm +++ b/lib/Catalyst/View/Email.pm @@ -32,9 +32,11 @@ In your app configuration (example in L): content_type: text/plain sender: method: SMTP - host: smtp.myhost.com - username: username - password: password + # mailer_args is passed directly into Email::Send + mailer_args: + - Host: smtp.example.com + - username: username + - password: password =cut @@ -49,8 +51,8 @@ In your controller, simply forward to the view after populating the C sub controller : Private { my ( $self, $c ) = @_; $c->stash->{email} = { - to => qq{catalyst@rocksyoursocks.com}, - from => qq{no-reply@socksthatarerocked.com}, + to => q{catalyst@rocksyoursocks.com}, + from => q{no-reply@socksthatarerocked.com}, subject => qq{Your Subject Here}, body => qq{Body Body Body} }; @@ -122,9 +124,8 @@ sub new { } } - if ( $mailer->mailer eq 'SMTP' ) { - my $host = $self->config->{sender}->{host} || 'localhost'; - $mailer->mailer_args([ Host => $host ]); + if ( $self->config->{sender}->{mailer_args} ) { + $mailer->mailer_args($self->config->{sender}->{mailer_args}); } $self->mailer($mailer); diff --git a/t/01use.t b/t/01use.t new file mode 100644 index 0000000..7a7f36e --- /dev/null +++ b/t/01use.t @@ -0,0 +1,3 @@ +use Test::More tests => 1; + +use_ok 'Catalyst::View::Email', 'Catalyst::View::Email::Template'; diff --git a/t/02pod.t b/t/02pod.t new file mode 100644 index 0000000..1647794 --- /dev/null +++ b/t/02pod.t @@ -0,0 +1,7 @@ +use Test::More; + +eval "use Test::Pod 1.14"; +plan skip_all => 'Test::Pod 1.14 required' if $@; +plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD}; + +all_pod_files_ok();