Differentiate tickets created by rt-mailgate

Hi.

I need to find out which tickets have been created by emails sent in to RT.
I’m thiking maybe I can add an attribute value with rt-mailgate, haven’t
checked the API yet.
Anyone know of a way to do this?

Thanks.
Kind regards.

Luke Vanderfluit.
Analyst/Programmer.
Internode Systems Pty. Ltd.

At Monday 6/12/2006 11:06 PM, Luke Vanderfluit wrote:

Hi.

I need to find out which tickets have been created by emails sent in to RT.
I’m thiking maybe I can add an attribute value with rt-mailgate,
haven’t checked the API yet.
Anyone know of a way to do this?

Thanks.
Kind regards.

We have a condition that goes in a scrip to determine this. The code
assumes that if the first attachment on a create transaction has a
‘Received’ header, it’s an email create. The code (from the
condition) is something like this:

 my $msgattr = $self->TransactionObj->Message->First;
 if ( $msgattr and $msgattr->GetHeader('Received') ) {
       # It's an email creation
 }

It seems to work OK. You could use this in a scrip to set a custom
field or whatever.

Steve

Originally, there was a page at
Request Tracker Wiki that described
this, but it appears to be gone now. You can do this in your scrips,
and here is the code:

Get the message attachment

my $msgattr = $self->TransactionObj->Attachments->First;
return 0 if (!$msgattr); # if no message attachment - assume web UI
return 0 if (!$msgattr->GetHeader(‘Received’)); # exit if not email
message

If you make it past those two lines, it must be an email message. I’ve
used this successfully on a few of my queues.

Eric Schultz
United Online-----Original Message-----
From: rt-users-bounces@lists.bestpractical.com
[mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Luke
Vanderfluit
Sent: Monday, June 12, 2006 8:07 PM
To: rt-users@lists.bestpractical.com
Subject: [rt-users] differentiate tickets created by rt-mailgate

Hi.

I need to find out which tickets have been created by emails sent in to
RT.
I’m thiking maybe I can add an attribute value with rt-mailgate, haven’t

checked the API yet.
Anyone know of a way to do this?

Thanks.
Kind regards.

Luke Vanderfluit.
Analyst/Programmer.
Internode Systems Pty. Ltd.

http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

We’re hiring! Come hack Perl for Best Practical:
http://bestpractical.com/about/jobs.html

Hi Stephen & Eric & all.

At Monday 6/12/2006 11:06 PM, Luke Vanderfluit wrote:

Hi.

I need to find out which tickets have been created by emails sent in
to RT.
I’m thiking maybe I can add an attribute value with rt-mailgate,
haven’t checked the API yet.
Anyone know of a way to do this?

Thanks.
Kind regards.

We have a condition that goes in a scrip to determine this. The code
assumes that if the first attachment on a create transaction has a
‘Received’ header, it’s an email create. The code (from the condition)
is something like this:

my $msgattr = $self->TransactionObj->Message->First;
if ( $msgattr and $msgattr->GetHeader('Received') ) {
      # It's an email creation
}

It seems to work OK. You could use this in a scrip to set a custom
field or whatever.

The page in the bestpractical wiki is now:
http://wiki.bestpractical.com/index.cgi?OnWebCorrespond

This was very helpful.
When a ticket is created via email, I set the ‘TimeLeft’ field, which is
otherwise unused in our organisation, to ‘1’ as a flag to later test on.

First I disable the default Autoreply to the queue in question
(Accounts) by modifying the default Autoreply on creation script,
modifying its condition:
/~~~~~~~~~~~~
if ( $self->TransactionObj->Type eq “Create” ) {
if ( $self->TicketObj->QueueObj->Name eq ‘Accounts’ ) { return 0; }
return 1;
}
____________
Then I create a scrip in the ‘Accounts’ queue that has a user-defined
condition for ‘autoreply to requestors’.
This is where I do the work on setting the ‘TimeLeft’ field:
/~~~~~~~~~
my $trans = $self->TransactionObj;

OnCreate:

return 0 unless $trans->Type eq “Create”;

Get the message attachment

my $msgattr = $trans->Message->First;
return 1 unless $msgattr; # no message attachment - assume web UI
if ($msgattr->GetHeader(‘Received’)) {
$self->TicketObj->Set( Field => ‘TimeLeft’, Value => 1);
return 1;
}
return 1;
_
_______

Thanks.
Kind regards.

Luke Vanderfluit.
Analyst/Programmer.
Internode Systems Pty. Ltd.