EmailRouting

From Request Tracker Wiki
Jump to navigation Jump to search

HowTo Request-Tracker Email Routing using Scrips

http://howtoforums.net/viewtopic.php?p=32#32

If you're going to route different emails to different queues based on domains then you might just find this "Scrip" useful. Scrip - is a terminology used in Request-Tracker to basically create an automatic rule based on a condition.

1. Make sure the system group "Everyone" has the following permissions on the General Queue:

* CreateTicket
  * Comment on Ticket
  * Reply on Ticket
  

2. Create a Scrip on the "General" queue using the parameters below.

Description: Scrip Description
Condition: On Create
Action: User Defined
Template: Global Template Blank
Stage: TransactionCreate

Custom action preparation code:

return 1;

Custom action cleanup code:

   # Domains we want to move
   my $domains = {};
   
   my %domain_map = (
                      '\@gmail\.com'        => "Queue 1",
                      '\@yahoo\.com'        => "Queue 2",
                      '\@hotmail\.com'      => "Queue 3",
                   );
   
   #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});
       }
   }

And of course modify this part to suite your own needs:

'\@gmail\.com' => "Queue 1",

Enjoy !

Jacob Baloul http://howtoforums.net