MIME headers should be MIME encoded. Fixes bug #11089.

This commit is contained in:
Colin Kuskie 2009-10-07 16:12:36 -07:00
parent af447ea570
commit 636ed5ce9a
3 changed files with 17 additions and 3 deletions

View file

@ -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

View file

@ -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));
}

View file

@ -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;