Skip to content

Commit

Permalink
MIME headers should be MIME encoded. Fixes bug #11089.
Browse files Browse the repository at this point in the history
  • Loading branch information
perlDreamer committed Oct 7, 2009
1 parent af447ea commit 636ed5c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/changelog/7.x.x.txt
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
- fixed #11098: Leaving a version tag makes everyone leave - fixed #11098: Leaving a version tag makes everyone leave
- fixed #11096: Error on deleting FAQ(CS)-item - fixed #11096: Error on deleting FAQ(CS)-item
- fixed #11060: Some tables have latin1 as the default character set - fixed #11060: Some tables have latin1 as the default character set
- fixed #11089: No message body in Notification


7.8.1 7.8.1
- mark $session->datetime->time as deprecated and remove its use from core code - mark $session->datetime->time as deprecated and remove its use from core code
Expand Down
3 changes: 2 additions & 1 deletion lib/WebGUI/Mail/Send.pm
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ sub addHeaderField {
my $self = shift; my $self = shift;
my $name = shift; my $name = shift;
my $value = 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));
} }




Expand Down
16 changes: 14 additions & 2 deletions t/Mail/Send.t
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use Test::More;
use Test::Deep; use Test::Deep;
use Data::Dumper; use Data::Dumper;
use MIME::Parser; use MIME::Parser;
use Encode qw/decode/; use Encode qw/decode encode/;


use WebGUI::Test; use WebGUI::Test;


Expand All @@ -42,7 +42,7 @@ if ( $@ ) { diag( "Can't prepare mail server: $@" ) }
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# Tests # 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 # Test create
Expand Down Expand Up @@ -115,6 +115,18 @@ is( $mime->parts(0)->as_string =~ m/\n/, $newlines,
"addHtmlRaw should add newlines after 78 characters", "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 # TODO: Test that addHtml creates a body with the right content type
my $smtpServerOk = 0; my $smtpServerOk = 0;


Expand Down

0 comments on commit 636ed5c

Please sign in to comment.