[rt-users] automatically adding new email tickets to a specific queue based on sender email-address

Ray Thompson rthompson at interpublic.com
Fri Jan 10 10:19:46 EST 2003


Probably not what you're looking for but we have a perl script that compares the sender to our directory and sets the queue based on the ou of the user.  If that person's not in our directory then the ticket is placed in the "General" queue.

/etc/mail/aliases:
support: "|/opt/rt2/bin/pickque"

/opt/rt2/bin/pickque:
#!/usr/bin/perl

my $filter = "";

$random = int( rand(64000) ) + 1;

open(OUTFILE,">/tmp/msg$random.txt") or die "Can't open output file $!";
while ($line = <STDIN>) {

        if ($line =~ /From:/) {
                $filter = "uid=";
                ($w1,$w2) = split("<",$line);
                ($uid,$domain) = split("@",$w2);
                $filter .= $uid;
                $entry = `ldapsearch -b \"o=True North\" -s sub -h chidir1 $filter dn`;
                $queue="general";
                if ($entry) {
                        $dn=$entry;
                        if ($dn =~ /Asia Pacific/) {
                                $queue = "Region - Asia/Pacific";
                        }
                        if ($dn =~ /Europe/) {
                                $queue = "Region - Europe";
                        }
                        if ($dn =~ /Latin America/) {
                                $queue = "Region - South America";
                        }
                        if ($dn =~ /North America/) {
                                $queue = "Region - North America";
                        }
                }
                #print "$queue\n";
        }
        print OUTFILE $line;
}
close OUTFILE;
$result = `/opt/rt2/bin/rt-mailgate --queue \'$queue\' --action correspond < /tmp/msg$random.txt`;
unlink "/tmp/msg$random.txt";



> -----Original Message-----
> From: rt-users-admin at lists.fsck.com 
> [mailto:rt-users-admin at lists.fsck.com] On Behalf Of Stefan Seiz
> Sent: Thursday, January 09, 2003 3:50 PM
> To: rt-users at lists.fsck.com
> Subject: [rt-users] automatically adding new email tickets to 
> a specific queue based on sender email-address
> 
> 
> Hi,
> 
> is it somehow possible (using rt 2.11) to automatically 
> assign tickets incoming via email to a Specific Queue based 
> on the requesters from-address?
> 
> What I want to achieve is, that any request from 
> user at domain.dom is added to queue "domain", but an request 
> from me at home.dom is assigned to queue "home".
> 
> Thanks
> Stefan
> PS: plese CC me, I'm on Digest
> 
> --
> <http://www.StefanSeiz.com>
> Spamto: <bin at imd.net>
> 
> _______________________________________________
> rt-users mailing list
> rt-users at lists.fsck.com 
> http://lists.fsck.com/mailman/listinfo/rt-> users
> 
> Have you 
> read the FAQ? The RT FAQ Manager lives at 
> http://fsck.com/rtfm
> 




More information about the rt-users mailing list