We now inserted var_dump($alerts, $autorespond); as you wrote and ran the cron manually which gave this output:
(when the reply from user was sent from Outlook email client which does not trigger an alert to the agent as stated before)
$ sudo php ./cron.php
bool(true)
bool(false)
So it seems that alerts=true, autorespond=false.
Then we ran the cron again after sending an email reply from user from Bluemail on Android phone to the same ticket, which does trigger an alert to the agent, and in this case the output was:
Both replies (the first one using Outlook, 2nd one using Bluemail) were replies to the exact same response email sent from osTicket to the user. Only the 2nd reply using Bluemail caused the alert to be sent.
I'm really wondering if something in the email header coming from Outlook messes things up. The thing is, I have no control over what email client customers are using. Most of them do use Outlook I'm afraid.
Any ideas? Many thanks!