Fou-Lu's suggestion is by far really the best way to go though perhaps its too late in V2 to start rewriting, thats your call.
for your existing code I can't see why you would get an email if there were was no error ... unless...
$_SESSION['resultsCode'] = 'ARTICLE_INDEX_NO_QUERY_STRING_2422';
when its an error it should be e.g.
$_SESSION['errorCode'] = 'ARTICLE_INDEX_NO_QUERY_STRING_2422';
I sounds like you issue an email for every resultsCode
when you should probably do a check at that satge of your logic for resultsCode
and act accordingly