Difference between revisions of "EmailRouting"

From Request Tracker Wiki
Jump to navigation Jump to search
m (3 revisions imported)
m
 
(One intermediate revision by the same user not shown)
Line 22: Line 22:
Custom action preparation code:
Custom action preparation code:


return 1;
<tt> return 1;</tt>


Custom action cleanup code:
Custom action cleanup code:


<nowiki># Domains we want to move
    # Domains we want to move
  my $domains = {};
    my $domains = {};
 
   
  my %domain_map = (
    my %domain_map = (
                    '\@gmail\.com'         =&gt; "Queue 1",
                      '\@gmail\.com'       => "Queue 1",
                    '\@yahoo\.com'        =&gt; "Queue 2",
                      '\@yahoo\.com'        => "Queue 2",
                    '\@hotmail\.com'      =&gt; "Queue 3",
                      '\@hotmail\.com'      => "Queue 3",
                  );
                    );
 
   
  #Check each of our defined domains for a match
    #Check each of our defined domains for a match
  foreach my $domainKey (keys %domain_map ){
    foreach my $domainKey (keys %domain_map ){
  if($self-&gt;TicketObj-&gt;RequestorAddresses =~ /^.*?${domainKey}/) {
    if($self->TicketObj->RequestorAddresses =~ /^.*?${domainKey}/) {
      # Domain matches - move to the right queue
        # Domain matches - move to the right queue
      $self-&gt;TicketObj-&gt;SetQueue($domain_map{$domainKey});
        $self->TicketObj->SetQueue($domain_map{$domainKey});
      }
        }
  }
    }
 
  </nowiki>


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


'\@gmail\.com'        =&gt; "Queue 1",
<tt> '\@gmail\.com'        =&gt; "Queue 1",</tt>


Enjoy !
Enjoy !


Jacob Baloul http://howtoforums.net
Jacob Baloul http://howtoforums.net

Latest revision as of 21:19, 17 August 2017

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