4 use RT::Test tests => undef;
8 my $queue = RT::Test->load_or_create_queue(
10 CorrespondAddress => 'rt-recipient@example.com',
11 CommentAddress => 'rt-recipient@example.com',
13 ok $queue && $queue->id, 'loaded or created queue';
15 my $user = RT::Test->load_or_create_user(
17 EmailAddress => 'root@localhost',
19 ok $user && $user->id, 'loaded or created user';
21 diag "Reply to ticket with actor as one time cc";
23 my $ticket = RT::Ticket->new( RT::CurrentUser->new( $user ) );
25 my ($status, undef, $msg) = $ticket->Create(
28 Requestor => 'root@localhost',
30 ok $status, "created ticket";
31 } { To => 'root@localhost' };
33 RT->Config->Set( NotifyActor => 1 );
35 my ($status, $msg) = $ticket->Correspond(
36 Content => 'test mail',
38 ok $status, "replied to a ticket";
39 } { To => 'root@localhost' };
41 RT->Config->Set( NotifyActor => 0 );
43 my ($status, $msg) = $ticket->Correspond(
44 Content => 'test mail',
46 ok $status, "replied to a ticket";
50 my ($status, $msg) = $ticket->Correspond(
51 Content => 'test mail',
52 CcMessageTo => 'root@localhost',
54 ok $status, "replied to a ticket";
55 } { Cc => 'root@localhost' };
58 diag "Reply to ticket with requestor squelched";
60 my $ticket = RT::Ticket->new( RT::CurrentUser->new( $user ) );
62 my ($status, undef, $msg) = $ticket->Create(
65 Requestor => 'test@localhost',
67 ok $status, "created ticket";
68 } { To => 'test@localhost' };
71 my ($status, $msg) = $ticket->Correspond(
72 Content => 'test mail',
74 ok $status, "replied to a ticket";
75 } { To => 'test@localhost' };
77 $ticket->SquelchMailTo('test@localhost');
79 my ($status, $msg) = $ticket->Correspond(
80 Content => 'test mail',
82 ok $status, "replied to a ticket";
86 my ($status, $msg) = $ticket->Correspond(
87 Content => 'test mail',
88 CcMessageTo => 'test@localhost',
90 ok $status, "replied to a ticket";
91 } { Cc => 'test@localhost' };
94 diag "Reply to ticket with multiple requestors squelched";
96 my $ticket = RT::Ticket->new( RT::CurrentUser->new( $user ) );
98 my ($status, undef, $msg) = $ticket->Create(
100 Subject => 'test squelch',
101 Requestor => ['test@localhost','bob@localhost','fred@localhost' ],
103 ok $status, "created ticket";
104 } { To => 'bob@localhost, fred@localhost, test@localhost' };
107 my ($status,$msg) = $ticket->Correspond(
108 Content => 'squelched email',
109 SquelchMailTo => ['bob@localhost', 'fred@localhost'],
111 ok $status, "replied to a ticket";
112 } { To => 'test@localhost' };
116 diag "Reply to ticket with requestor squelched";
118 my $ticket = RT::Ticket->new( RT::CurrentUser->new( $user ) );
120 my ($status, undef, $msg) = $ticket->Create(
123 Requestor => 'test@localhost',
125 ok $status, "created ticket";
126 } { To => 'test@localhost' };
129 my ($status, $msg) = $ticket->Correspond(
130 Content => 'test mail',
132 ok $status, "replied to a ticket";
133 } { To => 'test@localhost' };
136 my ($status, $msg) = $ticket->Correspond(
137 Content => 'test mail',
138 SquelchMailTo => ['test@localhost'],
140 ok $status, "replied to a ticket";
144 my ($status, $msg) = $ticket->Correspond(
145 Content => 'test mail',
147 ok $status, "replied to a ticket";
148 } { To => 'test@localhost' };
151 my ($status, $msg) = $ticket->Correspond(
152 Content => 'test mail',
153 CcMessageTo => 'test@localhost',
154 SquelchMailTo => ['test@localhost'],
156 ok $status, "replied to a ticket";
157 } { Cc => 'test@localhost' };
160 diag "Requestor is an RT address";
162 my $ticket = RT::Ticket->new( RT::CurrentUser->new( $user ) );
164 my ($status, undef, $msg) = $ticket->Create(
167 Requestor => 'rt-address@example.com',
169 ok $status, "created ticket";
170 } { To => 'rt-address@example.com' };
172 RT->Config->Set( RTAddressRegexp => qr/^rt-address\@example\.com$/i );
174 my ($status, $msg) = $ticket->Correspond(
175 Content => 'test mail',
177 ok $status, "replied to a ticket";
181 my ($status, $msg) = $ticket->Correspond(
182 Content => 'test mail',
183 CcMessageTo => 'rt-address@example.com',
185 ok $status, "replied to a ticket";