I've try to set a filter that recognize empty email and then sends an auto-reply from the canned response.

i've this text on my empty email:

Telefono: 123456789
Versione dell'app: x.x.x
Dispositivo: iPhone
Versione di iOS: xx.x.x

Inserisci i dettagli della richiesta :

Inviato da iPhone

The empty email have the string "Inserisci i dettagli della richiesta :" followed by a blank line.
I tried using a match to with one of the following regular expressions:

/\n^Inserisci i dettagli della richiesta :\n\n/ui
/Inserisci i dettagli della richiesta :\n\n/

screenshot: https://prnt.sc/sfvqcwjCjvzc

But the filter does not work.

Tested with https://regex101.com/ my RegEx rules works correctly. Why not on OsTicket?

Suggestions?

Cm-8 changed the title to How to use RegExp in Ticket filters for Auto-Reply 2024.
Cm-8 changed the title to How to use RegEx in Ticket filters for Auto-Reply.
5 days later

Cm-8

It should. Maybe the content doesn’t actually have \n at the beginning. Add debug statements to the code to log the raw content when it gets to the regex matching.

Cheers.

Dear @KevinTheJedi
Ok, i can try.
Where can I add debug statements to log the raw content when it comes to the regular expression match?

Thank you

    Cm-8

    Right above this line you can add something like:

    if ($func == 'pregMatchB')
        var_dump($what[$rule['w']]);

    The $what[$rule['w']] should be the value it's trying to match on which should be the email content in this case (if you are using Issue Details).

    Cheers.

    Thanks,
    i add:

    // LOG REGEX
    if ($func == 'pregMatchB') {
    	var_dump($what[$rule['w']]);
    	error_log($what[$rule['w']]);
    	file_put_contents('logs-filter.txt', $what[$rule['w']] . PHP_EOL, FILE_APPEND);
    }

    But there is not the possibility to put into debug information visible at: ./scp/logs.php ?

    Thanks

      Cm-8

      Not unless you add such code. You can look at the rest of the code to see how we log to system logs.

      Cheers.

      Write a Reply...