Browse Source

Bug 26948: Remove double encoding from sent emails

The sent emails from Koha were garbled / double encoded because
Koha::Email now after the refactoring and moving to use Email::Stuffer
handles the encoding itself. Previously the Koha::Email callee had to
handle the encoding. This patch removes the double encoding in the
email subject and content.

To test:
 1) Put some UTF-8 characters like ä in the HOLD template subject and body
 2) Create hold and check-in an item to make it Waiting and cause the
 email to be send
 3) Notice the email comes garbled / double encoded
 4) Apply patch
 5) Repeat step 2) and notice the email comes without any issues in
    encoding and look OK.
 6) Make sure "prove t/Koha/Email.t" and "prove
    t/db_dependent/Letters.t" and passes

Signed-off-by: Jonathan Druart <>
Signed-off-by: Kyle M Hall <>
Signed-off-by: Martin Renvoize <>

Signed-off-by: Jonathan Druart <>
Joonas Kylmälä 7 months ago
1 changed files with 1 additions and 3 deletions
  1. +1

+ 1
- 3
C4/ View File

@@ -1315,11 +1315,9 @@ sub _send_message_by_email {

# Encode subject line separately
$message->{subject} = encode('MIME-Header', $message->{'subject'} );
my $subject = $message->{'subject'};

my $content = encode('UTF-8', $message->{'content'});
my $content = $message->{'content'};
my $content_type = $message->{'content_type'} || 'text/plain; charset="UTF-8"';
my $is_html = $content_type =~ m/html/io;