Set($RTAddressRegexp , undef);
+=item C<$IgnoreCcRegexp>
+
+C<$IgnoreCcRegexp> is a regexp to exclude addresses from automatic addition
+to the Cc list. Use this for addresses that are I<not> received by RT but
+are sometimes added to Cc lists by mistake. Unlike C<$RTAddressRegexp>,
+these addresses can still receive email from RT otherwise.
+
+=cut
+
+Set($IgnoreCcRegexp, undef);
+
=item C<$CanonicalizeEmailAddressMatch>, C<$CanonicalizeEmailAddressReplace>
RT provides functionality which allows the system to rewrite
Set($RTAddressRegexp , undef);
+=item C<$IgnoreCcRegexp>
+
+C<$IgnoreCcRegexp> is a regexp to exclude addresses from automatic addition
+to the Cc list. Use this for addresses that are I<not> received by RT but
+are sometimes added to Cc lists by mistake. Unlike C<$RTAddressRegexp>,
+these addresses can still receive email from RT otherwise.
+
+=cut
+
+Set($IgnoreCcRegexp, undef);
+
=item C<$CanonicalizeEmailAddressMatch>, C<$CanonicalizeEmailAddressReplace>
RT provides functionality which allows the system to rewrite
my $user = $args{'CurrentUser'}->UserObj;
return
- grep $_ ne $current_address && !RT::EmailParser->IsRTAddress( $_ ),
+ grep { $_ ne $current_address
+ && !RT::EmailParser->IsRTAddress( $_ )
+ && !IgnoreCcAddress( $_ )
+ }
map lc $user->CanonicalizeEmailAddress( $_->address ),
map Email::Address->parse( $args{'Head'}->get( $_ ) ),
qw(To Cc);
}
+=head2 IgnoreCcAddress ADDRESS
+Returns true if ADDRESS matches the $IgnoreCcRegexp config variable.
+
+=cut
+
+sub IgnoreCcAddress {
+ my $address = shift;
+ if ( my $address_re = RT->Config->Get('IgnoreCcRegexp') ) {
+ return 1 if $address =~ /$address_re/i;
+ }
+ return undef;
+}
=head2 ParseSenderAddressFromHead HEAD