Ok folks , this is what i have done . In rt-mailgate under /etc/smrsh/ i have created a sub:
sub get_id { my $key1; my $value1; while ( my ($key1, $value1) = each(%message) ) { open (FILE, $value1) or die "Could not open "; my @array = <FILE>; my $element = 'subject'; if(my @found = grep(/\b$element\b/i,@array)) { my $output = join(",", @found); $output =~s/,*$//; my $start = index($output,"#"); if($start > -1) { my $end = index($output,"]",$start); if($end > -1) { my $myticket = substr($output,$start +1 ,$end-$start-1); return($myticket); } return (-1); } } } } Then in the code , after *read message from stdin * my $tickNo = get_id(); if($tickNo == -1){ print STDERR "New Ticket \n"; } elsif ($tickNo >10000){ print STDERR "Send To new System \n"; } else{ $destUrl = $opts{'otherurl'}; print STDERR "Send To Old System \n"; } print STDERR "$tickNo \n"; BUT the problem here is the way i managed to get the ticketnumber extracted from %message. This %message in rt is used first as my %message = write_down_message(); does it mean this is a global hash variable ? which to my understanding is not good practice i.e global variables should not be used. Is there a way that i can extract ticket number from the write_message_down() function rather than using a global variable ? hope that makes sense . cheers Steve Anderson-5 wrote: > > Bah! I missed an s. As I said, I've not tested it ;) > > my $full_url="http://NewRTInstance/REST/1.0/NoAuth/mail-gateway"; > foreach my $line (split(/\n/,$opts{'headers'})) > { > if ($line ~= /^\tsubject:/i) > { > if($line ~=/\[tag #\d{1,4}\]/i) > { > $full_url=" http://OldRTInstance/REST/1.0/NoAuth/mail-gateway"; > } > } > } > > > -----Original Message----- > From: rt-users-boun...@lists.bestpractical.com > [mailto:rt-users-boun...@lists.bestpractical.com] On Behalf Of aseim99 > Sent: 11 May 2011 14:26 > To: rt-users@lists.bestpractical.com > Subject: Re: [rt-users] Old RT and New RT ? > > > Hello mate, thanks for that code. > I am getting this following error. > > Global symbol "%opt" requires explicit package name at ./rt-mailgate line > 152. > syntax error at ./rt-mailgate line 154, near "$line ~" > Execution of ./rt-mailgate aborted due to compilation errors. > > > > > aseim99 wrote: >> >> Hello we have an old RT , i think its 3.6 . Now we are planing on >> deploying new one i.e 3.8. >> My question is that we will like old tickets to still go to old rt system >> and any tickets above 10,000 id number will go to new system. So in >> essence the mail gateway or something else ? will forward tickets having >> id number less that 10,000 to the old rt and anything above that will go >> to new rt with new queues on new rt. Then after some time we will disable >> the old system and only new one will be there , this is to avoid any >> downtime. >> RT is a brilliant system and we are looking to use it more , but this >> needs to be possible or my manager wont go ahead with the new system. >> Any suggestions and helps much appreciated. >> Cheers >> > > -- > View this message in context: > http://old.nabble.com/Old-RT-and-New-RT---tp31558446p31594199.html > Sent from the Request Tracker - User mailing list archive at Nabble.com. > > > ______________________________________________ > This email has been scanned by Netintelligence > http://www.netintelligence.com/email > > > BiP Solutions Limited is a company registered in Scotland with Company > Number SC086146 and VAT number 383030966 and having its registered > office at Medius, 60 Pacific Quay, Glasgow, G51 1DZ. > > **************************************************************************** > This e-mail (and any attachment) is intended only for the attention of > the addressee(s). Its unauthorised use, disclosure, storage or copying > is not permitted. If you are not the intended recipient, please destroy > all copies and inform the sender by return e-mail. > This e-mail (whether you are the sender or the recipient) may be > monitored, recorded and retained by BiP Solutions Ltd. > E-mail monitoring/ blocking software may be used, and e-mail content may > be read at any time.You have a responsibility to ensure laws are not > broken when composing or forwarding e-mails and their contents. > **************************************************************************** > > -- View this message in context: http://old.nabble.com/Old-RT-and-New-RT---tp31558446p31646721.html Sent from the Request Tracker - User mailing list archive at Nabble.com.