Autoresolve based on email

Hi there,

New user here. I’m trying to configure RT for my organization, but I am a bit stuck with some scripting within RT. I’ve tried to read the docs but I still don’t know how to accomplish what I am intending to do.

The thing is, I would like to create a script so that whenever new tickets are created, if the sender email ends with, say, ‘@yahoo.com’, it is automatically resolved.

Can I get some guidance on this matter? I find no examples of this, or maybe I am not looking at the right places.

Best regards,
Gonzalo

You could create a custom scrip that uses the “On Create” condition, a blank template and a user defined action. In the action you’d have a custom action preparation code something like this:

if( $self->TicketObj->RequestorAddresses =~ /\@yahoo.com/) {
  $self->TicketObj->SetStatus( "resolved" );
}
return 1;

You can then have a custom action commit code of just return 1; in this example because I did all the work in the prep (as it was a simple single operation).

1 Like

Thank you very much for your reply, GreenJimII! That is exactly what I was looking for.
I was wondering, though, does this notify anyone by default? I would like to disable the notifications upon automatic resolving tickets.

Thank you in advance.

That scrip has a blank template so won’t send out an email itself. If you have other scrips that do send out emails on new ticket creation those will still be run, so if you didn’t want them you’ll need to have similar custom conditions to ignore tickets you don’t want to respond to.

I should also mention that scrips that fire off on the change of status to resolve will also be launched because of the change made by this scrip, and they could also result in emails being sent.

1 Like

Hi again,

I think I understand it now. But I would now like to go a step further: checking both the sender and receiver’s emails, and also the ticket name… is that even possible? I found this website https://rt-wiki.bestpractical.com/wiki/ClassObjectsMethods which helped me understand the code you wrote, but there are no fields like the ticket name in there… am I missing something?

Thank you in advance

Ticket methods can be found here:
https://docs.bestpractical.com/rt/5.0.0/RT/Ticket.html

1 Like

Hello Gonzalo

If you simply want to block external senders from creating tickets for you, you may prefer to filter them at the MTA level, so they don’t even reach your RT.