rt 4.0.6
[freeside.git] / rt / t / mail / specials-in-encodedwords.t
1 use strict;
2 use warnings;
3
4 use RT::Test tests => undef;
5
6 diag "specials (, and ;) in MIME encoded-words aren't treated as specials";
7 {
8     # RT decodes too early in the game (i.e. before parsing), so it needs to
9     # ensure special characters in encoded words are properly escaped/quoted
10     # after decoding
11
12     RT->Config->Set( ParseNewMessageForTicketCcs => 1 );
13     my $mail = <<'.';
14 From: root@localhost
15 Subject: testing mime encoded specials
16 Cc: a@example.com, =?utf8?q?d=40example.com=2ce=40example.com=3b?=
17     <b@example.com>; c@example.com
18 Content-Type: text/plain; charset=utf8
19
20 here's some content
21 .
22
23     my ( $status, $id ) = RT::Test->send_via_mailgate($mail);
24     is( $status >> 8, 0, "The mail gateway exited normally" );
25     ok( $id, "Created ticket" );
26
27     my $ticket = RT::Ticket->new( RT->SystemUser );
28     $ticket->Load($id);
29     ok $ticket->id, 'loaded ticket';
30
31     my @cc = @{$ticket->Cc->UserMembersObj->ItemsArrayRef};
32     is scalar @cc, 3, "three ccs";
33     for my $addr (qw(a b c)) {
34         ok( (scalar grep { $_->EmailAddress eq "$addr\@example.com" } @cc),
35             "found $addr" );
36     }
37 }
38
39 done_testing;
40