Limiting EMaills

Hello! I am wondering how to  limit email verification limit per minute, so i wont get suspended


Thanks In Forward!

  • General approach I took since my shared host also limits emails per hour:

    1. Disable normal notifications
    2. Set up cron
    3. Add plugin hook to send emails on cron
    4. Make sure you mark emails sent somehow so people don't get duplicates!

    Required custom code.

  • Dear Evan,

    Please tell me cron job, and codes, and hook please,


    Thanks In Forward!

  • Documentation about plugin hooks:

    Check also the garbagecollector and logrotate plugins for examples on how to use cron with plugin hooks.

  • what crons i need, i am trying to limit every plugin

  • Some explanation - not a ready solution!

    Setting up the cronjobs on the server does nothing regarding limiting the emails as such. The cronjobs getting executed (per minute, fivemin, etc.) is just a requirement to be able to queue emails at all.

    What you would have to do by writing a plugin hook is collecting all emails (more precisely: notifications and messaged by "mail" method) and prevent them from getting sent immediately. You have to queue up all collected emails and then send them (via a cron plugin hook) on the next execution of the cronjob you decided to use - but of course send a number of X emails at once. For example you could decide on using the 5 min cronjob, i.e. each time this cronjob is triggered (if configured on the server), a maximum number of X emails is sent from the emails that have queued up.

    It's not a trivial task to get this implemented:

    • you have to make it working for all plugins (some might not using the default "mail" method but add their own method),
    • your code has to manage the mail queue (make sure all mails are sent but not send them twice),
    • what happens if there are more mails to be send on average than allowed by the restrictions on your shared server? As a consequence the queue would increase more and more.

    Elgg 1.9 will queue notifications and messages and send them out by cronjob together (but I think there's no option implemented to limit the maximum number of mails sent and it's maybe quite difficult to backport this new notification handling to Elgg 1.8).

    Emails from account registrations will most likely also be the least of the problems regarding the number of mails sent. By default, email sending is enabled in the notifications settings of Elgg for new accounts. The number of mails sent for example due to comments made on content will surely be much higher than from account registering. A plugin to turn off the mail method by default is the SetNoNotifications plugin ( This will reduce the number of mails if your users don't turn on the mail method again (rather unlikely for all). Still they are not denied from turning it on again. For preventing them from turning on the email sending as available notification method you would have to override the default notification settings view via a customized plugin to remove the mail method as a notification method offered to your users.

Performance and Scalability

Performance and Scalability

If you've got a need for speed, this group is for you.