[rt-users] Scrip works on tickets created via RT web interface but not via e-mail
Steve Hopps
steve.hopps at gmail.com
Tue Dec 2 16:22:31 EST 2008
Solved the problem, here is the custom condition I finally ended up with
(borrowed liberally from other people's examples!)
my $attachs = $self->TransactionObj->Attachments;
my $attach;
while( my $a = $attachs->Next ) { if( $a->ContentType eq 'text/plain' ){
$attach = $a; last } }
my $content = $attach->Content;
my $test = 0;
$test = 1 if ($content =~ m/We're sorry, the caller hung up/i); if($test ==
1) { return 1; }
return;
Hope someone finds this helpful!
-Steve
On Tue, Dec 2, 2008 at 10:07 AM, Steve Hopps <steve.hopps at gmail.com> wrote:
> I think I figured it out! Because Phonetag still attaches a .wav file, the
> body of the e-mail is not the first attachment, which is what my scrip was
> looking for.
> I don't know how to re-write that part but I'm digging through info now to
> find out. Of course if anyone can expedite that for me I would appreciate
> it, but hopefully this helps anyone who wants to do something similar :)
>
> - Steve
>
>
> On Mon, Dec 1, 2008 at 10:51 AM, Steve Hopps <steve.hopps at gmail.com>wrote:
>
>> Hi everyone, I'm trying to create a scrip that parses incoming e-mails and
>> rejects tickets with a certain phrase. I've got the scrip to work on all
>> tickets created in the queue via the RT web interface, but emails that come
>> into that queue still make it through. Does anybody know what I could be
>> missing that would cause it to work on tickets created via the web
>> interface, but not tickets created via e-mail?
>> Here's what I've got in the scrip:
>> ----------------------------------------------------
>> Condition: User Defined
>> Action: User Defined
>> Template: Global template: Blank
>> Stage: TransactionCreate
>>
>> Custom Condition:
>> my $Ticket = $self->TicketObj; my $Transaction = $self->TransactionObj; my
>> $Attachment = $Transaction->Attachments; my $AttFirst = $Attachment->First;
>> my $Content = $AttFirst->Content; my $test = 0; $test = 1 if (lc($Content)
>> =~ m/the caller hung up before leaving a message/i); if($test == 1) { return
>> 1; } return;
>>
>> Custom Action Prep:
>> $self->TicketObj->SetStatus( "rejected" ); return 1;
>>
>> Custom Action Cleanup:
>> return 1;
>> ----------------------------------------------------
>>
>> I greatly appreciate any help, thanks!
>>
>>
>> -Steve
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20081202/9daa60d1/attachment.htm>
More information about the rt-users
mailing list