summaryrefslogtreecommitdiff
path: root/rt/t/mail/specials-in-encodedwords.t
blob: 36efcd5e785dddd1f595809674aa6dcb9ea99a21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
use strict;
use warnings;

use RT::Test tests => undef;

diag "specials (, and ;) in MIME encoded-words aren't treated as specials";
{
    # RT decodes too early in the game (i.e. before parsing), so it needs to
    # ensure special characters in encoded words are properly escaped/quoted
    # after decoding

    RT->Config->Set( ParseNewMessageForTicketCcs => 1 );
    my $mail = <<'.';
From: root@localhost
Subject: testing mime encoded specials
Cc: a@example.com, =?utf8?q?d=40example.com=2ce=40example.com=3b?=
    <b@example.com>, c@example.com
Content-Type: text/plain; charset=utf8

here's some content
.

    my ( $status, $id ) = RT::Test->send_via_mailgate($mail);
    is( $status >> 8, 0, "The mail gateway exited normally" );
    ok( $id, "Created ticket" );

    my $ticket = RT::Ticket->new( RT->SystemUser );
    $ticket->Load($id);
    ok $ticket->id, 'loaded ticket';

    my @cc = @{$ticket->Cc->UserMembersObj->ItemsArrayRef};
    is scalar @cc, 3, "three ccs";
    for my $addr (qw(a b c)) {
        ok( (scalar grep { $_->EmailAddress eq "$addr\@example.com" } @cc),
            "found $addr" );
    }
}

done_testing;