5 use RT::Test nodb => 1, tests => 10;
7 RT->Config->Set( RTAddressRegexp => qr/^rt\@example.com$/i );
10 ok(require RT::EmailParser);
12 is(RT::EmailParser::IsRTAddress("","rt\@example.com"),1, "Regexp matched rt address" );
13 is(RT::EmailParser::IsRTAddress("","frt\@example.com"),undef, "Regexp didn't match non-rt address" );
15 my @before = ("rt\@example.com", "frt\@example.com");
16 my @after = ("frt\@example.com");
17 ok(eq_array(RT::EmailParser->CullRTAddresses(@before),@after), "CullRTAddresses only culls RT addresses");
20 require RT::Interface::Email;
22 RT::Interface::Email::ParseAddressFromHeader('foo@example.com');
23 is( $addr, 'foo@example.com', 'addr for foo@example.com' );
24 is( $name, undef, 'no name for foo@example.com' );
27 RT::Interface::Email::ParseAddressFromHeader('Foo <foo@example.com>');
28 is( $addr, 'foo@example.com', 'addr for Foo <foo@example.com>' );
29 is( $name, 'Foo', 'name for Foo <foo@example.com>' );
32 RT::Interface::Email::ParseAddressFromHeader('foo@example.com (Comment)');
33 is( $addr, 'foo@example.com', 'addr for foo@example.com (Comment)' );
34 is( $name, undef, 'no name for foo@example.com (Comment)' );