From 3d4cedda1dabe29c2c24888a30e62472cfea8b35 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Tue, 17 Oct 2017 14:44:00 -0700 Subject: fix MIME::Entity usage for perl 5.18+, RT#77890 --- FS/FS/Misc.pm | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'FS/FS/Misc.pm') diff --git a/FS/FS/Misc.pm b/FS/FS/Misc.pm index a2d1b3e..4d9d57b 100644 --- a/FS/FS/Misc.pm +++ b/FS/FS/Misc.pm @@ -157,7 +157,10 @@ sub send_email { unshift @mimeparts, { 'Type' => ( $options{'content-type'} || 'text/plain' ), 'Charset' => 'UTF-8', - 'Data' => $options{'body'}, + 'Data' => ( $options{'content-type'} =~ /^text\// + ? Encode::encode_utf8( $options{'body'} ) + : $options{'body'} + ), 'Encoding' => ( $options{'content-type'} ? '-SUGGEST' : '7bit' ), 'Disposition' => 'inline', }; @@ -166,7 +169,10 @@ sub send_email { @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' ), 'Charset' => 'UTF-8', ); @@ -377,7 +383,7 @@ sub generate_email { 'Encoding' => 'quoted-printable', 'Charset' => 'UTF-8', #'Encoding' => '7bit', - 'Data' => $data, + 'Data' => Encode::encode_utf8($data), 'Disposition' => 'inline', ); @@ -398,7 +404,7 @@ sub generate_email { ' ', ' ', ' ', - @html_data, + ( map Encode::encode_utf8($_), @html_data ), ' ', '', ], -- cgit v1.1