diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 641e8c1e2..82d303929 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -2,6 +2,7 @@ - fixed #11098: Leaving a version tag makes everyone leave - fixed #11096: Error on deleting FAQ(CS)-item - fixed #11060: Some tables have latin1 as the default character set + - fixed #11089: No message body in Notification 7.8.1 - mark $session->datetime->time as deprecated and remove its use from core code diff --git a/lib/WebGUI/Mail/Send.pm b/lib/WebGUI/Mail/Send.pm index b9f69e424..2bf1cb1ab 100644 --- a/lib/WebGUI/Mail/Send.pm +++ b/lib/WebGUI/Mail/Send.pm @@ -115,7 +115,8 @@ sub addHeaderField { my $self = shift; my $name = shift; my $value = shift; - $self->getMimeEntity->head->add($name, $value); + #$self->getMimeEntity->head->add($name, $value); + $self->getMimeEntity->head->add($name, encode('MIME-Q', $value)); } diff --git a/t/Mail/Send.t b/t/Mail/Send.t index eeedfd964..1c3a5773d 100644 --- a/t/Mail/Send.t +++ b/t/Mail/Send.t @@ -19,7 +19,7 @@ use Test::More; use Test::Deep; use Data::Dumper; use MIME::Parser; -use Encode qw/decode/; +use Encode qw/decode encode/; use WebGUI::Test; @@ -42,7 +42,7 @@ if ( $@ ) { diag( "Can't prepare mail server: $@" ) } #---------------------------------------------------------------------------- # Tests -plan tests => 16; # Increment this number for each test you create +plan tests => 17; # Increment this number for each test you create #---------------------------------------------------------------------------- # Test create @@ -115,6 +115,18 @@ is( $mime->parts(0)->as_string =~ m/\n/, $newlines, "addHtmlRaw should add newlines after 78 characters", ); +use utf8; +$mail = WebGUI::Mail::Send->create( $session, { + to => 'norton@localhost', + subject => "H\x{00C4}ufige Fragen", +}); +$mail->addHeaderField('List-ID', "H\x{00C4}ufige Fragen"); +my $messageId = $mail->queue; +diag $messageId; +my $dbMail = WebGUI::Mail::Send->retrieve($session, $messageId); +diag ref $dbMail; +is($dbMail->getMimeEntity->head->get('List-ID'), "=?UTF-8?Q?H=C3=84ufige=20Fragen?=\n", 'addHeaderField: handles utf-8 correctly'); + # TODO: Test that addHtml creates a body with the right content type my $smtpServerOk = 0;