[wp-hackers] How to throttle emails on hosts with email sending limits?

Thomas Belknap dragonfly at dragonflyeye.net
Thu Oct 15 01:04:24 UTC 2009

I built something for a band with 400+ fans to allow them to send out posts
as mailing list messages. With that, I just used WP Cron to schedule emails
sent every twenty minutes in 50-recipient chunks. On 1and1.com, which they
use, it so far hasn't presented a problem. DH sounds a bit extreme, so you
might need to throttle down farther.
If you're looking to keep comment emails down, one quick answer might be
just using Intense Debate to manage comments. That way, emails aren't being
sent from or through DH servers.

Otherwise, it seems like just checking the database for new comments every
hour and sending a digest of comments shouldn't be that hard to achieve
without the need to save stuff to a second table. Set a WP Cron to check
every hour - if you're really worried about getting that many comments,
there shouldn't be any worries about firing the pseudocron - and just bundle
the comments up as a single email.

On Wed, Oct 14, 2009 at 8:18 PM, William Canino <
william.canino at googlemail.com> wrote:

> I definitely ought to figure this out soon.
> I installed WordPress on Dreamhost today.  DH has a "100 recipients
> per hour" limit.
> Even without plugins, if the blog gets 101 comments in one hour,
> wordpress's "new comment" notification emails to the post authors will
> hit the limit.
> Therefore I will have to override wp_mail() itself.
> The new wp_mail() somehow needs to remember how many recipients have
> been sent in the last 3600 seconds.  Three ways to do this:
> 1. I have it accumulate emails unto a wp_option setting and with
> wp_schedule_event send just enough during the top of every hour. On
> the average they get it half an hour late.
> 2. I store each email as a record in a table, and record the sent
> times, all within a SQL SELECT-UPDATE-COMMIT transaction.  Thankfully,
> the emails don't have 2Mb attachments!
> 3. A better option?
> Sorry if ask again, guys, has anyone integrated mail queuing code to
> WordPress?

More information about the wp-hackers mailing list