I need disable Email Notifications Permanently


sorry for my english...

I need to disable email notifications permanently,eg for internal messages, comments, new entries,etc ... and just leave it enabled to recover passwords, registration form and invite friends ...how do we do?

Recently I saw a plugin that disables the default option for email notifications but only works when a user signs up on the site later if he or she activates the option, the administrator can not disable it, at least not cleanly ...

use: elgg 1.7.15, and the plugin of Cash phpMailer

For example if i have 300 active users and use gmail smtp... 
in less than 4 hours I'll get to daily limit, and users who register or request new password do not come to the email .. = (

do you understand me?


  • unregister_notification_handler('email')


    I don't know if that will affect password recovery (I would hope not) you may need to test it.

  • Matt is the first thing I did,(I look in the references) not post it because I blocked the mail in general, registration form and request a new password
  • In that case you can hook into the email hook and prevent all non-registration/forgot password emails.

    It's messier and you'll probably have to do something to remove the email option from user settings.


    // return TRUE/FALSE to stop elgg_send_email() from sending
    00306     $mail_params = array(
    00307                             'to' => $to,
    00308                             'from' => $from,
    00309                             'subject' => $subject,
    00310                             'body' => $body,
    00311                             'params' => $params
    00312                     );
    00314     $result = elgg_trigger_plugin_hook('email', 'system', $mail_params, NULL);
    00315     if ($result !== NULL) {
    00316         return $result;
    00317     }

  • I think I found a quick and simple solution but ignoring usability xD
    I put "site" default in notify_user ... the trouble is that it ignores the user preference but I did not want was to spend on email resources ...
    is what I found most acceptable given my low quality of programming, I hope some day, to know this as you! jejej


     * Notify a user via their preferences.
     * @param mixed $to Either a guid or an array of guid's to notify.
     * @param int $from GUID of the sender, which may be a user, site or object.
     * @param string $subject Message subject.
     * @param string $message Message body.
     * @param array $params Misc additional parameters specific to various methods.
     * @param mixed $methods_override A string, or an array of strings specifying the delivery methods to use - or leave blank
     * 				for delivery using the user's chosen delivery methods.
     * @return array Compound array of each delivery user/delivery method's success or failure.
     * @throws NotificationException
    function notify_user($to, $from, $subject, $message, array $params = NULL, $methods_override = "site") {
    	// Sanitise
    	if (!is_array($to)) {
    		$to = array((int)$to);
    	$from = (int)$from;
    	//$subject = sanitise_string($subject);
    	// Get notification methods
    	if (($methods_override) && (!is_array($methods_override))) { 

    $methods_override = array($methods_override); 

  • @DevCreative I like your approch. I am going to use this. Thanks a lot.

  • @Matt I understand but I dont get other option to do that. Please advise.

  • @Matt and @DevCreative

    I have reverted back changes in core file. And use following plugin and its great.