[rt-users] Initial Queue Detection

Meo, Anthony Anthony.Meo at btci.com
Tue Apr 5 00:42:16 EDT 2005



I tested briefly and the email address is changed appropriately.  More
configuration etc...tomorrow, when I'm not falling asleep. 

Thanks very much for the help, this has been a great push in the right
direction (if not half the solution altogether.)

Cheers!
-Anthony




Now I understand. I'll try to help but I'm not in a position
to test my suggestions right now so you'll have to test them
and get back to me.

First, I think we can change the From address for all emails
by adding a From header to each template.

Go to: Configuration->Global->Templates

and add a From line to the top of each template, like this example:

==== Template Correspondence =======
From: <makeupsomeaddress at yourcompany.com>
RT-Attach-Message: yes

{$Transaction->Content()}

==== END of Template =====

The blank line between the headers is important. Now send
and e-mail by replying to a ticket and make sure the From
address is the one you added and not the one for the 
queue.


Next, we want to write a function that gets the correspond
address of a ticket based on the first queue.

==== File /opt/rt3/local/lib/RT/Ticket_Local.pm ====
use strict;
no warnings qw(redefine);

sub FirstQueueEmail {

    my $self = shift;
    my $email = $self->QueueObj->CorrespondAddress;

    my $transactions = $self->Transactions;
    $transactions->Limit( FIELD => 'Type', VALUE => 'Set' );
    $transactions->Limit( FIELD => 'Field', VALUE => 'Queue' );
    if ( $transactions->Count ) {
        my $queue_id = $transactions->First->OldValue;
        my $queue = RT::Queue->new( $RT::SystemUser );
        my ($rv, $msg) = $queue->Load($queue_id);
        $email = $queue->CorrespondAddress if $rv;
    }

    return $email;
}

1;
==== END File ====

Finally, if the header tests in the rist step worked, change the
from line to:

From: { $Ticket->FirstQueueEmail }

Let me know if you have problems.

-Todd



More information about the rt-users mailing list