KevinTheJedi
Okay,
So I have done a lot of digging into the postMessage function, and after many var_dumps and emails going back and forth, I discovered that the issue boils down to the $vars being passed into the function with $vars['autorespond'] set to true on some emails replies coming in, and $vars['autorespond'] set to false on others…
I can prove this because at the very top of the function I put this line:
var_dump('VarsAutoRespondAtTop:', isset($vars['autorespond']) ? $vars['autorespond'] : 'Autorespond var not set');
and when running the cron job manually at a command prompt, I would get true or false depending on where the email reply was coming from… (vars[‘autorespond’] was always set, I would never get “var not set” from that)…
… Now earlier, I mentioned that the yahoo mails coming in were not showing anything in the output… Somehow, when I was working with it later in the night, the yahoo mails WERE showing output… I think what might have been happening is that even though I turned off the chron job (or the Windows scheduled task), the helpdesk was still seeing activity from the other member in our support group. Because of that, I think emails were still being fetched (because of the activity?), and it was (I guess) perfectly correlated with when I was testing yahoo mail and when I was testing my home mail … At least that is what I think was going on because when I was testing this off-hours I was getting responses from the var_dumps each time I sent in an email…
One other thing about the home mail…. I have several portals for that email, I can use my Thunderbird email client, or I can use the email client on my cell phone, or the zoho web mail portal for my account… So when I reply to a helpdesk email from the Thunderbird client or my email client off my cell phone, I would get agent alerts every time… When I reply to a helpdesk email from the zoho web mail portal, I would not get an agent reply every time…. So, even from the same email account, just the email client I am using does seem to make a difference… I must have tested this at least 10 times from each client, replying to the same exact agent response email, and I get the same results every time… And, of course, email responses generating from the yahoo web mail client, or the gmail web mail client, never result in an agent alert in any of the tests…
Anyhow, I spent a while testing var_dumps for everything, in and around the area of code we were testing before, and I found that after this code is run:
$reopen = $autorespond; // Do not reopen bounces
if ($autorespond && $message->isBounceOrAutoReply())
$autorespond = $reopen= false;
elseif ($autorespond && isset($vars['autorespond']))
$autorespond = $vars['autorespond'];
The $autorespond would show true or false depending on the email source… Then I narrowed it down to the $vars['autorespond']; , and from there I noticed that the function was just being passed the vars set that way right in the vars parameter to the function… (the IsBounceOrAutoReply would always return “False” in all my tests, so that is not the issue here)..
Anyhow, clearly there is something going on with emails depending on the source and client being used to make the replies… I don’t know if this can be found in the headers, or somewhere else, and from here I am not sure where to go…
The good news here, I think, is that I can finally narrow the issue down to some very specific circumstances… Before it all seemed kind of random and we would sometimes get alerts and sometimes not, and this drove us crazy… Now I can reliably reproduce the issue and I get the same results every time I take certain actions.. Also, I think I know (at least in a general sense) where in the PHP code this issue lies, even though I have no idea what to check for next or how to fix it…
This is a lot more than I knew just yesterday…
So what do you think??
If you would like, I can send you headers again, except this time from the same email account (just from different portals), as we are getting different results depending on the portal… Would that be helpful??