[rt-users] Disabling autoreply to certain users: solution

ben at atomicmatrix.net ben at atomicmatrix.net
Mon Feb 14 11:52:42 EST 2005


I did some searching and hopefully I didn't re-invent the wheel here.  I
wanted to disable autoreplies for any email addresses matching a list of
regular expressions.  This works on my dev environment, and I'm about to
take it to the live environment.  I hope it helps someone.
Feedback/improvement is welcome, too.

$RTHOME/local/lib/RT/Action/Autoreply_Local.pm:

---------
use strict;
no warnings qw(redefine);

# {{{ sub SetRecipients
sub SetRecipients {
    my $self=shift;

    my @recipients = $self->TicketObj->Requestors->MemberEmailAddresses;
    open (FH, $RT::NoAutoreply);
    while (<FH>) {
        chomp;
        my $line = $_;
        next if ($line =~ /^#/);
        @recipients = grep (!/^$line$/is, @recipients);
    }
    close (FH);

    push(@{$self->{'To'}}, @recipients);

    return(1);
}
# }}}

1;
---------

Append this to $RTHOME/etc/RT_SiteConfig.pm:

---------
Set($NoAutoreply, '/usr/local/rt3/etc/noautoreply');
---------

And then add stuff like this to the file pointed to by $NoAutoreply:

---------
root at .*\.domain\.com
someemail at otherdomain.com
---------

This was built and lightly tested under RT 3.0.10 (perl 5.6.1).

	-=| Ben




More information about the rt-users mailing list