Dear RT users /admins:
We are struggling to get RT to not autoreply to certain addresses with certain subject in their mails.
Is there any way to set any autoreply related variable to avoid sending an autoreply based on this condition?
We think we should use something like:
For the condition, just return 0; instead of that $self->TicketObj->Do No Autoply;. That way the condition isnât true so the associated action commit (which I assume is the auto reply youâre turning off) wonât be fired.
Hello, GreenJimll:
Thank you!
Iâm giving it a try right away.
By the way, this code goes into the box called Custom Action Preparation Code, right?
Are the two other boxes suppossed to be empty?
Thank you very much.
If youâre using a pre-existing condition (such as âOn Createâ or âOn Commentâ, etc) with a custom action, then this can go in the action preparation section, with your custom actionâs actual commit code in the last text box.
If however youâre using a pre-defined action and just want to change the condition, this will need to go on in the first, custom condition box.
You might want some other conditions included as well (for example checking that the transaction type was a particular value or what the status of the ticket is), as otherwise this will fire on all transactions that donât have that subject pattern sent by that requestor email.
Hello again, GreenJimll:
First of all, let me thank you all your help.
Unfortunately, after several trials I wasnât able to make it work. This is how I set it up, which I am not sure if it is correct. To make it clear, let me please be explicit on how I have donde it:
Condition: User Defined.
Action: Autoreply to requestors.
Layout: blank.
Custom condition:
if( $self->TicketObj->RequestorAddresses =~ /myMailAddress@gmail.com/) {
if ($self->TicketObj->Subject =~/mySuject/){
return 0;
}
}
return 1;
Custom preparation code box and custom personalized action box are empty.
If you had a blank template and still got an autoreply message, you might want to check if you have any other scrips that will fire off with that message. Remember that all the applied scrips that are valid when a transaction takes place will be queued up to execute one after the other.
If itâs complaining about preparing, it tends to imply its trying to fire off a custom action still (as prepare and commit are the two parts of an action), rather than just a custom condition.
That means your condition isnât returning a true value. Iâd add some logging to the custom condition and see if something isnât returning true where you expect it to be
The scrip commits if I return 1 instead of returning 0 as GreenJim proposed, but is still sending mail, so I guess I am doing something wrong. This is the code I have now:
I can see debug output in the logs saying âshould not send mailâ, but it is still autoreplying anyway.
To let it clear, the condition is user defined, my action is autoreply to requestors and the template is autoreply in HTML.
If true, I would have to return 1 or return 0? As you see, Iâm a bit lost.