This code is wrong because it will not take the target user's language into account
Phpfox::getLib('mail')->to($aRow['user_id']) ->subject(Phpfox::getPhrase('module.var')) ->message(Phpfox::getPhrase('module.var'))
This next is correct:
Phpfox::getLib('mail')->to($aRow['user_id']) ->subject(array('module.var')) ->message(array('module.var'))
That is basically it, since you are passing the user_id in the ->to() function the mail library will pick up the language for that user, and by passing an array instead of the actual phrase the mail library will get the correct phrase, you can also include an array of parameters if you like as a second element in the array:
Phpfox::getLib('mail')->to($aRow['user_id']) ->subject(array('module.var', array('param1' => 'val1'))) ->message(array('module.var', array('param2' => 'val2')))
and it will run the replacements as if you had done a getPhrase. Our fix was to Replace In Files all
->subject(Phpfox::getPhrase
with
->subject(array
and same for
->message.