Registering email, system hook is not working on Elgg3.2.2

I have a website running on Elgg2.3.7 and have a plugin to handle email notifications for the system. This plugin is used in a testing environment to redirect email notifications to predefined email address instead of sending to all users who turn on their notification settings. 

# plugin code 

function init( ) {

   elgg_register_plugin_hook_handler('email', 'system', 'mail_handler_function', 1);

}

function mail_handler_function($hook, $type, $result, $params)  {

   //get an email address - notification emails will go to this address   

   $receiver = elgg_get_plugin_setting('email_address', 'plugin_id');

   mail($receiver, 'subject', 'body', 'header');

}

Registering hook above works with Elgg2.3.7. But the mail_handler_function is not triggered in Elgg3.2.2. Is there any plugin hook that I can use to intercept both enqueued and instant notifications?

 

Thanks in advance!

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking