unfucked version
[catagits/Catalyst-View-Email.git] / lib / Catalyst / View / Email.pm
index b02b934..db99dfc 100644 (file)
@@ -4,11 +4,12 @@ use Moose;
 use Carp;
 
 use Encode qw(encode decode);
-use Email::Sender::Simpleer::Simple qw/ sendmail /;
+use Email::Sender::Simple qw/ sendmail /;
 use Email::MIME::Creator;
 extends 'Catalyst::View';
 
-our $VERSION = '0.21';
+our $VERSION = '0.27';
+$VERSION = eval $VERSION;
 
 has 'mailer' => (
     is      => 'rw',
@@ -19,7 +20,7 @@ has 'mailer' => (
 
 has '_mailer_obj' => (
     is      => 'rw',
-    isa     => 'Email::Sender::Simpleer::Transport',
+    isa     => 'Email::Sender::Transport',
     lazy    => 1,
     builder => '_build_mailer_obj',
 );
@@ -47,19 +48,15 @@ has 'sender' => (
 
 has 'content_type' => (
     is      => 'rw',
-       isa     => 'Str',
-       default => sub { shift->default->{content_type} },
-       lazy    => 1,
+    isa     => 'Str',
+    default => sub { shift->default->{content_type} },
+    lazy    => 1,
 );
 
 =head1 NAME
 
 Catalyst::View::Email - Send Email from Catalyst
 
-=head1 VERSION
-
-version 0.19
-
 =head1 SYNOPSIS
 
 This module sends out emails from a stash key specified in the
@@ -96,12 +93,12 @@ In your app configuration:
             # Setup how to send the email
             # all those options are passed directly to Email::Sender::Simple
             sender => {
-                # if mailer doesn't start with Email::Sender::Simpleer::Transport::,
+                # if mailer doesn't start with Email::Sender::Simple::Transport::,
                 # then this is prepended.
                 mailer => 'SMTP',
                 # mailer_args is passed directly into Email::Sender::Simple 
                 mailer_args => {
-                    host     => 'smtp.example.com', # defaults to localhost
+                    Host     => 'smtp.example.com', # defaults to localhost
                     username => 'username',
                     password => 'password',
             }
@@ -206,17 +203,17 @@ sub BUILD {
 }
 
 sub _build_mailer_obj {
-  my ($self) = @_;
-  my $transport_class = ucfirst $self->sender->{mailer};
+    my ($self) = @_;
+    my $transport_class = ucfirst $self->sender->{mailer};
 
-  # borrowed from Email::Sender::Simpleer::Simple -- apeiron, 2010-01-26 
-  if ($transport_class !~ /^Email::Sender::Simpleer::Transport::/) {
-    $transport_class = "Email::Sender::Simpleer::Transport::$transport_class";
-  }
+    # borrowed from Email::Sender::Simple -- apeiron, 2010-01-26
+    if ( $transport_class !~ /^Email::Sender::Transport::/ ) {
+        $transport_class = "Email::Sender::Transport::$transport_class";
+    }
 
-  Class::MOP::load_class($transport_class);
+    Class::MOP::load_class($transport_class);
 
-  return $transport_class->new($self->sender->{mailer_args} || {});
+    return $transport_class->new( $self->sender->{mailer_args} || {} );
 }
 
 =item process($c)
@@ -357,10 +354,8 @@ sub generate_message {
     my ( $self, $c, $attr ) = @_;
 
     # setup the attributes (merge with defaultis)
-       $attr->{attributes} = $self->setup_attributes($c, $attr->{attributes});
-    Email::MIME->create(
-           %$attr
-       );
+    $attr->{attributes} = $self->setup_attributes( $c, $attr->{attributes} );
+    Email::MIME->create( %$attr );
 }
 
 =back
@@ -371,7 +366,7 @@ sub generate_message {
 As with most things computer related, things break.  Email even more so.  
 Typically any errors are going to come from using SMTP as your sending method,
 which means that if you are having trouble the first place to look is at
-L<Email::Sender::Simple::SMTP>.  This module is just a wrapper for L<Email::Sender::Simple>,
+L<Email::Sender::Transport::SMTP>.  This module is just a wrapper for L<Email::Sender::Simple>,
 so if you get an error on sending, it is likely from there anyway.
 
 If you are using SMTP and have troubles sending, whether it is authentication