[Catalyst-commits] r6628 - in trunk/Catalyst-View-Email/lib/Catalyst/View: . Email

jshirley at dev.catalyst.perl.org jshirley at dev.catalyst.perl.org
Wed Aug 8 20:46:22 GMT 2007


Author: jshirley
Date: 2007-08-08 20:46:21 +0100 (Wed, 08 Aug 2007)
New Revision: 6628

Modified:
   trunk/Catalyst-View-Email/lib/Catalyst/View/Email.pm
   trunk/Catalyst-View-Email/lib/Catalyst/View/Email/Template.pm
Log:
Updates to mailer_args, pod -- support of hash and array of mailer_args.  Version bump to 0.05

Modified: trunk/Catalyst-View-Email/lib/Catalyst/View/Email/Template.pm
===================================================================
--- trunk/Catalyst-View-Email/lib/Catalyst/View/Email/Template.pm	2007-08-08 19:36:02 UTC (rev 6627)
+++ trunk/Catalyst-View-Email/lib/Catalyst/View/Email/Template.pm	2007-08-08 19:46:21 UTC (rev 6628)
@@ -10,7 +10,7 @@
 
 use base qw|Catalyst::View::Email|;
 
-our $VERSION = '0.02';
+our $VERSION = '0.03';
 
 =head1 NAME
 

Modified: trunk/Catalyst-View-Email/lib/Catalyst/View/Email.pm
===================================================================
--- trunk/Catalyst-View-Email/lib/Catalyst/View/Email.pm	2007-08-08 19:36:02 UTC (rev 6627)
+++ trunk/Catalyst-View-Email/lib/Catalyst/View/Email.pm	2007-08-08 19:46:21 UTC (rev 6628)
@@ -11,7 +11,7 @@
 
 use base qw|Catalyst::View|;
 
-our $VERSION = '0.04';
+our $VERSION = '0.05';
 
 __PACKAGE__->mk_accessors(qw(sender stash_key content_type mailer));
 
@@ -35,10 +35,16 @@
             method:     SMTP
             # mailer_args is passed directly into Email::Send 
             mailer_args:
-                - Host:       smtp.example.com
-                - username:   username
-                - password:   password
+                Host:       smtp.example.com # defaults to localhost
+                username:   username
+                password:   password
 
+=head2 NOTE ON SMTP
+
+If you use SMTP and don't specify Host, it will default to localhost and
+attempt delivery.  This often times means an email will sit in a queue
+somewhere and not be delivered.
+
 =cut
 
 __PACKAGE__->config(
@@ -126,8 +132,15 @@
         }
     }
 
-    if ( $self->sender->{mailer_args} ) {
-        $mailer->mailer_args($self->sender->{mailer_args});
+    if ( my $args = $self->sender->{mailer_args} ) {
+        if ( ref $args eq 'HASH' ) {
+            $mailer->mailer_args([ %$args ]);
+        }
+        elsif ( ref $args eq 'ARRAY' ) {
+            $mailer->mailer_args($args);
+        } else {
+            croak "Invalid mailer_args specified, check pod for Email::Send!";
+        }
     }
 
     $self->mailer($mailer);
@@ -203,6 +216,8 @@
 
 Daniel Westermann-Clark
 
+Simon Elliott <cpan at browsing.co.uk> - ::Template
+
 =head1 LICENSE
 
 This library is free software, you can redistribute it and/or modify it under




More information about the Catalyst-commits mailing list