Skip to content
Permalink
Browse files

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

  • Loading branch information...
perlDreamer committed Oct 7, 2009
1 parent af447ea commit 636ed5ce9a5fc9ea38aab78b12e7d8989c91e3e1
Showing with 17 additions and 3 deletions.
  1. +1 −0 docs/changelog/7.x.x.txt
  2. +2 −1 lib/WebGUI/Mail/Send.pm
  3. +14 −2 t/Mail/Send.t
@@ -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
@@ -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));
}


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

0 comments on commit 636ed5c

Please sign in to comment.
You can’t perform that action at this time.