Maximum recipients allowed

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,
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.

I suppose it’s for incoming mails, right? If so, best place is in the
MTA/MDA imho.

If you wan’t to limit this when people enter adresses in RT web
interface, then you have to use a callback like the one use in the
extension RT::Extension::MandatoryRequestor.

Easter-eggs Spécialiste GNU/Linux
44-46 rue de l’Ouest - 75014 Paris - France - Métro Gaité
Phone: +33 (0) 1 43 35 00 37 - Fax: +33 (0) 1 43 35 00 76
mailto:elacour@easter-eggs.com - http://www.easter-eggs.com

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;

}

Hi,

thanks Ken ! It works like a charm… :slight_smile:

OlivierLe 19/05/2014 15:02, ktm@rice.edu a écrit :

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;

}

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;

}

Hi,

I upgraded my RT version to 4.2.5, and this hack Ken gave me to limit
recipients number doesn’t seem to work any more… (except if I missed
something in my tests)

I didn’t find any other solution and I was wondering if there was a way
to have this working in my RT version.

Thanks

Olivier

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;

}

Hi,

I upgraded my RT version to 4.2.5, and this hack Ken gave me to limit
recipients number doesn’t seem to work any more… (except if I missed
something in my tests)

I didn’t find any other solution and I was wondering if there was a
way to have this working in my RT version.

Thanks


Olivier

Hi,

responding to myself if someone is interested…

I tested this (see below) and it works to limit to 10 recipients.

Modified Function to limit recipients number

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

 my $current_address = lc $args{'CurrentUser'}->EmailAddress;
 my $user = $args{'CurrentUser'}->UserObj;

 my @res =
     grep $_ ne $current_address && !RT::EmailParser->IsRTAddress( $_ ),
     map lc $user->CanonicalizeEmailAddress( $_->address ),
     map RT::EmailParser->CleanupAddresses( Email::Address->parse( 

$args{‘Head’}->get( $_ ) ) ),
qw(To Cc);

 @res = @res[0..9] if($#res > 9);

 return @res;

}

Olivier