Many web-hosts have limits on the number of emails that may be sent, before the site is considered spamming. For example 200/hour, or similar. It would be good if this module could support such a limit, and send queued emails over as long a period of time as required...
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | queue_mail.daily-limits.845116.patch | 4.54 KB | lyricnz |
| #1 | queue_mail.daily-limits.845116.patch | 4.68 KB | lyricnz |
| #2 | queue_mail.daily-limits.845116.patch | 4.54 KB | lyricnz |
Comments
Comment #1
lyricnz commentedHere is a quick patch to queue_mail that creates a limit on the number of emails that will be queued at any one time, and puts any extras into a separate queue. Then a new job is added to the job queue, that pulls items from this separate queue and submits them to the real queue.
Notes:
- the limit is configured in at /admin/settings/queue_mail - this is the limit *per cron run* (usually hourly)
- you may want to configure the priority of sending of individual emails to be higher (lower number) than the unbatching of mails over the limit - at /admin/settings/job_queue
- if mails are being queued *while* cron is running, you may get mails sent out-of-order
Comment #2
lyricnz commentedUpdate patch to use the job_queue function, rather than description, to find our jobs.
Comment #3
lyricnz commentedUpdate patch to just add enough mails to refill the queue to the specified limit.
Comment #4
mattcasey commentedThanks lyricnz, I am setting up a new site and want this feature. I've manually updated my module and will report back when I successfully use it.
Slightly related: I am using Simplenews, which allows me to throttle per cron run. Does that mean I don't need to use Queue Mail and Job Queue?
Comment #5
webwriter commentedI have installed the patch and am waiting for my next Sunmailer run to go out Wednesday to see if it works properly, but it looks good so far. Thank you very much for this functionality.
Comment #6
Freso commentedNot tested, but just from a quick glance, I can tell that
variable_del('queue_mail_limit');is missing from the uninstall function.Also, it doesn't look like mails sends immediately (as opposed to being queued) are subtracted from the queue limit. If the webhost indeed does have an hourly (or otherwise) limit, setting queue_limit to that may end up causing some mail to fail, as immediately sent mail will make it cross that threshold. Of course you could guess/estimate a probable margin, but you may still run into problems with just that odd day where a lot of users have lost their passwords - plus, sending a mail to hundreds of users at a rate of 93-95 users/hour is considerably faster than at 70/users per hour (or however low one has decided to set it). All of this is, though, probably feature creep and should be added as a patch of its own once this gets in (if ever...).
Comment #7
scottcheek commentedAny chance this functionality could be ported to D7?
Comment #8
lyricnz commentedThe maintainer never bothered to apply this patch in over 2 years, so I'm not inclined to spend time porting the patch myself.
Comment #9
steven jones commentedJust a quick note (from the D7 branch maintainer):
As we basically just put things in to a Drupal queue now, it would make much more sense to have something that can limit the rate at which things are removed from any queue, and so such a feature wouldn't get into the D7 branch, so there's not any point in porting. Sorry!
Comment #10
sinn commented