removed Bcc options per https://rt.cpan.org/Public/Bug/Display.html?id=75775
[catagits/Catalyst-View-Email.git] / lib / Catalyst / View / Email.pm
index 768bd93..9dc49e3 100644 (file)
@@ -8,7 +8,7 @@ use Email::Sender::Simple qw/ sendmail /;
 use Email::MIME::Creator;
 extends 'Catalyst::View';
 
-our $VERSION = '0.26';
+our $VERSION = '0.32';
 $VERSION = eval $VERSION;
 
 has 'mailer' => (
@@ -124,7 +124,6 @@ Sending email is just filling the stash and forwarding to the view:
         $c->stash->{email} = {
             to      => 'jshirley@gmail.com',
             cc      => 'abraxxa@cpan.org',
-            bcc     => join ',', qw/hidden@secret.com hidden2@foobar.com/,
             from    => 'no-reply@foobar.com',
             subject => 'I am a Catalyst generated email',
             body    => 'Body Body Body',
@@ -245,8 +244,6 @@ sub process {
       if $email->{to};
     push @$header, ( 'Cc' => delete $email->{cc} )
       if $email->{cc};
-    push @$header, ( 'Bcc' => delete $email->{bcc} )
-      if $email->{bcc};
     push @$header, ( 'From' => delete $email->{from} )
       if $email->{from};
     push @$header,
@@ -280,6 +277,9 @@ sub process {
         $mime{attributes}->{charset} = $self->{default}->{charset};
     }
 
+    $mime{attributes}->{encoding} = $email->{encoding} 
+        if $email->{encoding};
+
     my $message = $self->generate_message( $c, \%mime );
 
     if ($message) {
@@ -307,7 +307,8 @@ sub setup_attributes {
     my ( $self, $c, $attrs ) = @_;
 
     my $default_content_type = $self->default->{content_type};
-    my $default_charset      = $self->default->{charset};
+    my $default_charset      = $self->default->{charset}; 
+    my $default_encoding     = $self->default->{encoding};
 
     my $e_m_attrs = {};
 
@@ -338,6 +339,24 @@ sub setup_attributes {
         $e_m_attrs->{charset} = $default_charset;
     }
 
+    if ( exists $attrs->{encoding}
+         && defined $attrs->{encoding}
+         && $attrs->{encoding} ne '' )
+    {
+        $c->log->debug(
+        'C::V::Email uses specified encoding '
+        . $attrs->{encoding}
+        . '.' )
+         if $c->debug;
+         $e_m_attrs->{encoding} = $attrs->{encoding};
+    }
+     elsif ( defined $default_encoding && $default_encoding ne '' ) {
+         $c->log->debug(
+         "C::V::Email uses default encoding $default_encoding.")
+         if $c->debug;
+         $e_m_attrs->{encoding} = $default_encoding;
+     }
+
     return $e_m_attrs;
 }