From 6244781bd0174247b23dd986cb384fba54c24884 Mon Sep 17 00:00:00 2001 From: Wesley Schwengle Date: Thu, 10 Oct 2019 23:41:34 +0200 Subject: [PATCH] Fix unicode bug in subject Fixes a bug where unicode chars in the subject aren't properly encoded: Wide character in syswrite at /usr/local/lib/perl5/5.30.0/Net/Cmd.pm line 210. --- lib/Act/Email.pm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/Act/Email.pm b/lib/Act/Email.pm index 5adf6ccb9..668acf930 100644 --- a/lib/Act/Email.pm +++ b/lib/Act/Email.pm @@ -3,7 +3,7 @@ use strict; package Act::Email; -use Encode (); +use Encode qw(encode); #use List::Pairwise qw(mapp); use Act::Config; @@ -67,9 +67,10 @@ sub send ); $args{body} = $dump . $args{body}; - push @headers, ( To => Email::Address->new('Act tester', $Config->email_test)->format(), - Subject => "[TEST] $args{subject}", - ); + push @headers, + (To => Email::Address->new('Act tester', $Config->email_test) + ->format()); + $args{subject} = "[TEST] $args{subject}"; } else { for my $header ( grep { exists $args{$_} } qw( to cc bcc ) ) @@ -81,8 +82,8 @@ sub send push @headers, ( ucfirst $header => join ', ', map { $_->format() } @recips ); } - push @headers, ( Subject => $args{subject} ); } + push @headers, ( Subject => encode('MIME-Header', $args{subject} )); my $charset; if ( $args{body} =~ /^\p{InBasicLatin}+$/ ) {