software:requesttracker:autoqueue
This is an old revision of the document!
Auto-Queue scrips
Based on sender e-mail
This scrip (not a typo, a scrip is an RT Script) can be added in the global scrip section and will automatically put a ticket in the proper queue based on the sender's e-mail address. In this case, we have senders coming from different domains (@example.net and @example2.com), and we want to put them into the queue's Example and Example 2 Queue when a new ticket arrives. Note: the queues must exist before this.
The hash %domain_map contains a Regular Expression (aka regex) to match. If the regex matches, the new ticket will be placed in the proper queue.
Note: A handy regex tester I use quite a bit is located at https://regex101.com/
# Written by RWR, taken from # https://forum.bestpractical.com/t/changing-queue-based-on-incoming-email-address/20925 # hash of all the possible domains, and matching queues my %domain_map = ( '@.?example.net' => 'Example', '@.?example2.com' => 'Example 2 Queue' ); #Check each of our defined domains for a match foreach my $domainKey (keys %domain_map ) { if ( $self->TicketObj->RequestorAddresses =~ /^.*?${domainKey}/ ) { # Domain matches - move to the right queue $self->TicketObj->SetQueue($domain_map{$domainKey}); } } return 1;
software/requesttracker/autoqueue.1724977644.txt.gz · Last modified: 2024/08/29 19:27 by rodolico