4 use RT::Test tests => 12;
7 my ($baseurl, $m) = RT::Test->started_ok;
9 diag "Testing non-ASCII in From: header";
11 skip "Test requires Email::Address 1.893 or later, "
12 . "you have $Email::Address::VERSION", 3,
13 if $Email::Address::VERSION < 1.893;
15 my $mail = Encode::encode( 'iso-8859-1', Encode::decode( "UTF-8", <<'.') );
16 From: René@example.com>
17 Reply-To: =?iso-8859-1?Q?Ren=E9?= <René@example.com>
18 Subject: testing non-ASCII From
19 Content-Type: text/plain; charset=iso-8859-1
25 warnings_like { ( $status, $id ) = RT::Test->send_via_mailgate($mail) }
26 [qr/Failed to parse Reply-To:.*, From:/,
27 qr/Couldn't parse or find sender's address/
29 'Got parse error for non-ASCII in From';
30 is( $status >> 8, 0, "The mail gateway exited normally" );
32 local $TODO = "Currently don't handle non-ASCII for sender";
33 ok( $id, "Created ticket" );
37 diag "Testing iso-8859-1 encoded non-ASCII in From: header";
39 skip "Test requires Email::Address 1.893 or later, "
40 . "you have $Email::Address::VERSION", 3,
41 if $Email::Address::VERSION < 1.893;
43 my $mail = Encode::encode( 'iso-8859-1', Encode::decode( "UTF-8", <<'.' ) );
44 From: =?iso-8859-1?Q?Ren=E9?= <René@example.com>
45 Reply-To: =?iso-8859-1?Q?Ren=E9?= <René@example.com>
46 Subject: testing non-ASCII From
47 Content-Type: text/plain; charset=iso-8859-1
53 warnings_like { ( $status, $id ) = RT::Test->send_via_mailgate($mail) }
54 [qr/Failed to parse Reply-To:.*, From:/,
55 qr/Couldn't parse or find sender's address/
57 'Got parse error for iso-8859-1 in From';
58 is( $status >> 8, 0, "The mail gateway exited normally" );
60 local $TODO = "Currently don't handle non-ASCII in sender";
61 ok( $id, "Created ticket" );
69 Subject: testing non-ASCII From
70 Content-Type: text/plain; charset=iso-8859-1
76 warnings_like { ( $status, $id ) = RT::Test->send_via_mailgate($mail) }
77 [qr/Couldn't parse or find sender's address/],
78 'Got parse error with no sender fields';
79 is( $status >> 8, 0, "The mail gateway exited normally" );
80 ok( !$id, "No ticket created" );