From: J. Shirley Date: Wed, 8 Aug 2007 19:46:21 +0000 (+0000) Subject: Updates to mailer_args, pod -- support of hash and array of mailer_args. Version... X-Git-Tag: v0.14~30 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=229f9fdd4c8e9381750af14937036eb6da0ebe10;p=catagits%2FCatalyst-View-Email.git Updates to mailer_args, pod -- support of hash and array of mailer_args. Version bump to 0.05 --- diff --git a/lib/Catalyst/View/Email.pm b/lib/Catalyst/View/Email.pm index e4be27c..b5593a4 100644 --- a/lib/Catalyst/View/Email.pm +++ b/lib/Catalyst/View/Email.pm @@ -11,7 +11,7 @@ use Email::MIME::Creator; use base qw|Catalyst::View|; -our $VERSION = '0.04'; +our $VERSION = '0.05'; __PACKAGE__->mk_accessors(qw(sender stash_key content_type mailer)); @@ -35,9 +35,15 @@ In your app configuration (example in L): 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 @@ -126,8 +132,15 @@ sub new { } } - 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 @@ Matt S Trout Daniel Westermann-Clark +Simon Elliott - ::Template + =head1 LICENSE This library is free software, you can redistribute it and/or modify it under diff --git a/lib/Catalyst/View/Email/Template.pm b/lib/Catalyst/View/Email/Template.pm index 5111a99..0202714 100644 --- a/lib/Catalyst/View/Email/Template.pm +++ b/lib/Catalyst/View/Email/Template.pm @@ -10,7 +10,7 @@ use Email::MIME::Creator; use base qw|Catalyst::View::Email|; -our $VERSION = '0.02'; +our $VERSION = '0.03'; =head1 NAME