]> ruin.nu Git - ndwebbie.git/commitdiff
Handle both utf8 and latin1 in mail
authorMichael Andreen <harv@ruin.nu>
Fri, 17 Jul 2020 14:38:51 +0000 (16:38 +0200)
committerMichael Andreen <harv@ruin.nu>
Fri, 17 Jul 2020 14:42:45 +0000 (16:42 +0200)
scripts/ndmail.pl

index 8941cc1cf8890ac0cb8a785cbd7412e24259248a..f90f4c68b770dd903e1d6458167c785e6ff9f260 100755 (executable)
@@ -30,6 +30,7 @@ use CGI qw/:standard/;
 use Email::Simple;
 use Email::StripMIME;
 use Encode;
+use Encoding::FixLatin qw(fix_latin);
 use MIME::QuotedPrint;
 
 use FindBin;
@@ -44,7 +45,7 @@ my $text = join '',@text;
 my $email = Email::Simple->new(Email::StripMIME::strip_mime($text));;
 
 my $subject = decode('MIME-Header', $email->header('Subject'));
-my $body = 'FROM:' . decode('UTF-8', decode_qp($email->header('From'))) . "\n\n" . decode('UTF-8',$email->body);
+my $body = 'FROM:' . decode('MIME-Header', $email->header('From')) . "\n\n" . fix_latin($email->body);
 
 
 $dbh->begin_work;