projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix MIME::Entity usage for perl 5.18+, RT#77890
[freeside.git]
/
FS
/
FS
/
Misc.pm
diff --git
a/FS/FS/Misc.pm
b/FS/FS/Misc.pm
index
164f1ba
..
ed4b103
100644
(file)
--- a/
FS/FS/Misc.pm
+++ b/
FS/FS/Misc.pm
@@
-156,7
+156,11
@@
sub send_email {
unshift @mimeparts, {
'Type' => ( $options{'content-type'} || 'text/plain' ),
unshift @mimeparts, {
'Type' => ( $options{'content-type'} || 'text/plain' ),
- 'Data' => $options{'body'},
+ 'Charset' => 'UTF-8',
+ 'Data' => ( $options{'content-type'} =~ /^text\//
+ ? Encode::encode_utf8( $options{'body'} )
+ : $options{'body'}
+ ),
'Encoding' => ( $options{'content-type'} ? '-SUGGEST' : '7bit' ),
'Disposition' => 'inline',
};
'Encoding' => ( $options{'content-type'} ? '-SUGGEST' : '7bit' ),
'Disposition' => 'inline',
};
@@
-165,7
+169,10
@@
sub send_email {
@mimeargs = (
'Type' => ( $options{'content-type'} || 'text/plain' ),
@mimeargs = (
'Type' => ( $options{'content-type'} || 'text/plain' ),
- 'Data' => $options{'body'},
+ 'Data' => ( $options{'content-type'} =~ /^text\//
+ ? Encode::encode_utf8( $options{'body'} )
+ : $options{'body'}
+ ),
'Encoding' => ( $options{'content-type'} ? '-SUGGEST' : '7bit' ),
);
'Encoding' => ( $options{'content-type'} ? '-SUGGEST' : '7bit' ),
);
@@
-252,12
+259,19
@@
sub send_email {
$smtp_opt{'ssl'} = 1 if defined($enc) && $enc eq 'tls';
$transport = Email::Sender::Transport::SMTP->new( %smtp_opt );
}
$smtp_opt{'ssl'} = 1 if defined($enc) && $enc eq 'tls';
$transport = Email::Sender::Transport::SMTP->new( %smtp_opt );
}
-
+
push @to, $options{bcc} if defined($options{bcc});
push @to, $options{bcc} if defined($options{bcc});
+ # fully unpack all addresses found in @to (including Bcc) to make the
+ # envelope list
+ my @env_to;
+ foreach my $dest (@to) {
+ push @env_to, map { $_->address } Email::Address->parse($dest);
+ }
+
local $@; # just in case
eval { sendmail($message, { transport => $transport,
from => $from,
local $@; # just in case
eval { sendmail($message, { transport => $transport,
from => $from,
- to => \@to }) };
+ to => \@
env_
to }) };
my $error = '';
if(ref($@) and $@->isa('Email::Sender::Failure')) {
my $error = '';
if(ref($@) and $@->isa('Email::Sender::Failure')) {
@@
-272,7
+286,7
@@
sub send_email {
if ( $conf->exists('log_sent_mail') ) {
my $cust_msg = FS::cust_msg->new({
'env_from' => $options{'from'},
if ( $conf->exists('log_sent_mail') ) {
my $cust_msg = FS::cust_msg->new({
'env_from' => $options{'from'},
- 'env_to' => join(', ', @to),
+ 'env_to' => join(', ', @
env_
to),
'header' => $message->header_as_string,
'body' => $message->body_as_string,
'_date' => $time,
'header' => $message->header_as_string,
'body' => $message->body_as_string,
'_date' => $time,
@@
-366,7
+380,7
@@
sub generate_email {
'Type' => 'text/plain',
'Encoding' => 'quoted-printable',
#'Encoding' => '7bit',
'Type' => 'text/plain',
'Encoding' => 'quoted-printable',
#'Encoding' => '7bit',
- 'Data' =>
$data
,
+ 'Data' =>
Encode::encode_utf8($data)
,
'Disposition' => 'inline',
);
'Disposition' => 'inline',
);
@@
-387,7
+401,7
@@
sub generate_email {
' </title>',
' </head>',
' <body bgcolor="#ffffff">',
' </title>',
' </head>',
' <body bgcolor="#ffffff">',
-
@html_data
,
+
( map Encode::encode_utf8($_), @html_data )
,
' </body>',
'</html>',
],
' </body>',
'</html>',
],