[rt-users] Maximum recipients allowed

ktm at rice.edu ktm at rice.edu
Mon May 19 09:02:50 EDT 2014


On Mon, May 19, 2014 at 02:41:19PM +0200, Olivier Lumineau wrote:
> Hi,
> we are using RT 3.8.7, and to filter spam more efficiently, I wanted
> to know if there was an easy way in RT to limit ticket recipients
> (to + cc + bcc) .
> 
> I don't want more than 10 or 15 recipients by ticket, to prevent
> that a spam withs hundreds mail addresses pollute our RT.
> 
> Thanks
> 
> -- 
> Olivier
> 
Hi Olivier,

I used the following in Email_Local.pm. Maybe you can do something similar.

Regards,
Ken
-----------------------
sub ParseCcAddressesFromHead {
    my %args = (
        Head        => undef,
        QueueObj    => undef,
        CurrentUser => undef,
        @_
    );

    my @recipients =
        map lc $_->address,
        map Email::Address->parse( $args{'Head'}->get( $_ ) ),
        qw(To Cc);

    my @res;
    foreach my $address ( @recipients ) {
        $address = $args{'CurrentUser'}->UserObj->CanonicalizeEmailAddress( $address );
        next if lc $args{'CurrentUser'}->EmailAddress   eq $address;
        next if lc $args{'QueueObj'}->CorrespondAddress eq $address;
        next if lc $args{'QueueObj'}->CommentAddress    eq $address;
        next if RT::EmailParser->IsRTAddress( $address );

        push @res, $address;
   }

    #
    # Limit the number of Cc addresses that we add to a
    # ticket during the initial create to minimize damage
    # to our Email reputation when SPAM slips through DSPAM.

    $RT::Logger->debug("$#res Ccs");
    if ( $#res > 3 ) {
        my @riceCc;
        my @nonriceCc;
        @riceCc = grep /rice.edu/i, @res;
        @nonriceCc = grep !/rice.edu/i, @res;
        $RT::Logger->debug("$#riceCc riceCcs, $#nonriceCc nonriceCcs");
        if ($#nonriceCc > 1) {
            @res = (@riceCc, @nonriceCc[0]);
        }
    }

    return @res;
}
-----------------------



More information about the rt-users mailing list