use Email::MIME::Creator;
extends 'Catalyst::View';
-our $VERSION = '0.25_02';
+our $VERSION = '0.32';
$VERSION = eval $VERSION;
has 'mailer' => (
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',
}
$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',
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,
$mime{attributes}->{charset} = $self->{default}->{charset};
}
+ $mime{attributes}->{encoding} = $email->{encoding}
+ if $email->{encoding};
+
my $message = $self->generate_message( $c, \%mime );
if ($message) {
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 = {};
$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;
}