From 8b81f0b93cceac74efc3add288cb7565b68fbd6d Mon Sep 17 00:00:00 2001 From: Nicholas van Oudtshoorn Date: Thu, 22 Aug 2013 16:56:25 +0800 Subject: [PATCH] Send html reports with the proper Content-Type Content-Type: text/plain; charset="utf-8" http://bugs.koha-community.org/show_bug.cgi?id=10777 --- misc/cronjobs/runreport.pl | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/misc/cronjobs/runreport.pl b/misc/cronjobs/runreport.pl index 2357ed8..18e175d 100755 --- a/misc/cronjobs/runreport.pl +++ b/misc/cronjobs/runreport.pl @@ -241,14 +241,25 @@ foreach my $report_id (@ARGV) { $message .= $csv->string() . "\n"; } } - if ($email){ - my %mail = ( - To => $to, - From => $from, - Subject => encode('utf8', $subject ), - Message => encode('utf8', $message ) - ); + my %mail; + if ($format eq 'html') { + $message = "$message"; + %mail = ( + To => $to, + From => $from, + 'Content-Type' => 'text/html', + Subject => encode('utf8', $subject ), + Message => encode('utf8', $message ) + ); + } else { + %mail = ( + To => $to, + From => $from, + Subject => encode('utf8', $subject ), + Message => encode('utf8', $message ) + ); + } sendmail(%mail) or carp 'mail not sent:' . $Mail::Sendmail::error; } else { print $message; -- 1.8.1.4