default to a session cookie instead of setting an explicit timeout, weird timezone...
[freeside.git] / rt / t / mail / multipart.t
1 use strict;
2 use warnings;
3
4 use RT::Test tests => 4, config => q{Set($CorrespondAddress, 'rt@example.com');};
5 use RT::Test::Email;
6
7 my $queue = RT::Test->load_or_create_queue( Name => 'General' );
8 my $user  = RT::Test->load_or_create_user( Name => 'bob', EmailAddress => 'bob@example.com' );
9 $queue->AddWatcher( Type => 'AdminCc', PrincipalId => $user->PrincipalObj->Id );
10
11 my $text = <<EOF;
12 Subject: Badly handled multipart email
13 From: root\@localhost
14 To: rt\@@{[RT->Config->Get('rtname')]}
15 Content-Type: multipart/alternative; boundary=20cf3071cac0cb9772049eb22371
16
17 --20cf3071cac0cb9772049eb22371
18 Content-Type: text/plain; charset=ISO-8859-1
19
20 Hi
21
22 --20cf3071cac0cb9772049eb22371
23 Content-Type: text/html; charset=ISO-8859-1
24 Content-Transfer-Encoding: quoted-printable
25
26 <div>Hi</div>
27
28 --20cf3071cac0cb9772049eb22371--
29 EOF
30
31 my ( $status, $id ) = RT::Test->send_via_mailgate($text);
32 is( $status >> 8, 0, "The mail gateway exited normally" );
33 ok( $id, "Created ticket" );
34
35 my @msgs = RT::Test->fetch_caught_mails;
36 is(@msgs,2,"sent 2 emails");
37 diag("We're skipping any testing of the autoreply");
38
39 my $entity = parse_mail($msgs[1]);
40 is($entity->parts, 2, "only two parts");