[rt-users] Resending last Correspondence

Steve Cochran stephen.cochran at kingarthurflour.com
Mon Mar 3 01:20:19 EST 2008


Due to the combined effect of two different configurations, some of  
our emails weren't getting delivered AND the errors weren't getting  
reported. Fun I know.

I generated a list of all the emails that would have failed, and what  
I'd like to do is have a script resend the last correspondence for any  
ticket created by those users in the last two weeks.

I have a query to get the ticket IDs going directly against mysql  
(doing something similar for reporting). I should be able to feed the  
ticket IDs into a perl script and find the last correspondence for  
those tickets like I'm doing in a template as follows:

{
  my $Transactions = $Ticket->Transactions;
$Transactions->Limit( FIELD => 'Type', VALUE => 'Correspond',  
SUBCLAUSE => 'kafquotesearch' );
$Transactions->Limit( FIELD => 'Type', VALUE => 'Create', SUBCLAUSE =>  
'kafquotesearch' );

  $Transactions->OrderByCols (
                { FIELD => 'Created',  ORDER => 'DESC' },
                { FIELD => 'id',     ORDER => 'DESC' },
                );

  my $last_correspondence;
  my $Correspondence = $Transactions->First;
  if( $Correspondence && $Correspondence->id ) {
    $last_correspondence = $Correspondence->Content;
  }



What I'm not sure about is the best way to script sending the  
correspondence. If anyone has a code example, I'd appreciate it and  
would be happy to send something yummy from the bakery!

Steve



More information about the rt-users mailing list