Changing sender->host to use mailer_args to be more compatible with Email::Send,...
J. Shirley [Sat, 19 May 2007 17:21:24 +0000 (17:21 +0000)]
lib/Catalyst/View/Email.pm
t/01use.t [new file with mode: 0644]
t/02pod.t [new file with mode: 0644]

index ac41fbc..8098fde 100644 (file)
@@ -32,9 +32,11 @@ In your app configuration (example in L<YAML>):
         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<stash_key>
     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 (file)
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 (file)
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();