Bug 15133: encode correctly email generated by runreport.pl
/misc/cronjobs/runreport.pl send badly encoded email in text/csv (partially ok in HTML). TEST: 1. Send by email a report containing a subject with accented characters and resultset with accented characters. For example: ./runreport.pl --subject="éèà" --to=me@home.org 1 ./runreport.pl --format=html --subject="éèà" --to=me@home.org 1 The first email contains badly encoded subject & message. The second email contains badly encoded subject, but correct message. 2. Apply the patch 3. Repeat 1 => No more strange characters. Signed-off-by: Liz Rea <liz@catalyst.net.nz> Characters are correctly encoded now, thanks for that good spot. Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> (cherry picked from commit9515db57bd) Signed-off-by: Frédéric Demians <f.demians@tamil.fr> (cherry picked from commitbfbddd183c) Signed-off-by: Liz Rea <wizzyrea@gmail.com>
This commit is contained in:
parent
781ccb9eaf
commit
1f0e4471d2
|
|
@ -270,27 +270,14 @@ foreach my $report_id (@ARGV) {
|
|||
}
|
||||
}
|
||||
if ($email){
|
||||
my $email = Koha::Email->new();
|
||||
my %mail;
|
||||
my $args = { to => $to, from => $from, subject => $subject };
|
||||
if ($format eq 'html') {
|
||||
$message = "<html><head><style>tr:nth-child(2n+1) { background-color: #ccc;}</style></head><body>$message</body></html>";
|
||||
%mail = $email->create_message_headers({
|
||||
to => $to,
|
||||
from => $from,
|
||||
contenttype => 'text/html',
|
||||
subject => encode('utf8', $subject ),
|
||||
message => encode('utf8', $message )
|
||||
}
|
||||
);
|
||||
} else {
|
||||
%mail = $email->create_message_headers ({
|
||||
to => $to,
|
||||
from => $from,
|
||||
subject => encode('utf8', $subject ),
|
||||
message => encode('utf8', $message )
|
||||
}
|
||||
);
|
||||
$message = "<html><head><style>tr:nth-child(2n+1) { background-color: #ccc;}</style></head><body>$message</body></html>";
|
||||
$args->{contenttype} = 'text/html';
|
||||
}
|
||||
$args->{message} = $message;
|
||||
my $email = Koha::Email->new();
|
||||
my %mail = $email->create_message_headers($args);
|
||||
$mail{'Auth'} = {user => $username, pass => $password, method => $method} if $username;
|
||||
sendmail(%mail) or carp 'mail not sent:' . $Mail::Sendmail::error;
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue