PDA

View Full Version : Cron based e-mail queuing and sending


Paul M
05 Feb 2006, 03:01
This modification is no longer available or supported.

Cron based e-mail queuing and sending.

At the moment, if you send a large number of e-mails, vbulletin either puts them in it's queue and then attempts to send them as each user visits a page, or in the case of the ACP Email users inteface, sends them straight away. As a result your server can become seriously overloaded very quickly - so sending several thousand e-mails (like a newsletter) can become very difficult (hours spent clicking next in the ACP !).

As a result I did this very simple modification to our forum to overcome the problem, and have since been asked about it a couple of times, so here it is.


This does two things ;

1. E-mails from the ACP inteface are sent to the mail queue, not straight to the mail system.

2. The processing of the mail queue is set-up as a vb cron item.


Obviously for this to work, you must turn e-mail queuing on in the ACP options - set 'Use Mailqueue System' to yes, and 'Number of Emails to Send Per Batch' to a realistic value (based on the cron setting, as below).

There are two realisitc options for the cron job, you can either set it to run every minute, and set the items to be processed to something small (like 10), or you can do what we do and set it to run every 15 minutes, and set the items to be processed to something larger (like 150).

Remember, 10 per minute = 600 per hour, 150 per 15 minutes is also 600 per hour. The numbers really depend on how quick you want large queues processed, and how much your mail server can handle in one go.


Once working, when using the ACP mail users inteface, remember you can do 9999 at once (not 500 or whatever) as the mails will now go into the queue, not be sent direct.

Note: This will affect any queued e-mails such as subscription e-mails. It will not affect registration e-mails as they bypass queuing anyway.




History:

v1.06 : First Release.

Replicators
05 Feb 2006, 03:49
Nice idea, i will definantly install

username12
05 Feb 2006, 07:06
Thank you! After the first time I tried to use the e-mail function, I decided not to do it again.

Snake
05 Feb 2006, 14:31
Great!
/me installs

Robert Basil
06 Feb 2006, 06:20
I'd LOVE to install this if it didn't require code changes. :(

lisquid
06 Feb 2006, 13:43
I'd LOVE to install this if it didn't require code changes. :(

PROBLEM: I sent one mass e-mail and it worked AMAZING the next day I tried to send another mass e-mail and it sent the same thing as the first one 0-0

Paul M
06 Feb 2006, 13:52
I'd LOVE to install this if it didn't require code changes. :(Two lines is harly a big deal !!

Not everything can be done by plugins.

Paul M
06 Feb 2006, 13:54
PROBLEM: I sent one mass e-mail and it worked AMAZING the next day I tried to send another mass e-mail and it sent the same thing as the first one 0-0It can only send what's in the queue.

Developer
07 Feb 2006, 04:58
nice i adore this hacks my server love them :)
installed

Paul M
09 Feb 2006, 09:09
nice i adore this hacks my server love them :)Glad you like it. :)

Brad
09 Feb 2006, 09:23
Thanks Paul, this is a perfect fit for a site I have planned that will be taking on a large number of users and sending out a lot of e-mail.

Akagi
23 Feb 2006, 09:06
im wondering, for the Mailqueue, do i need to set "Yes,with locking", say if i've got a site with 20k members?

Paul M
23 Feb 2006, 09:23
You shouldn't need locking with this as there is no potential for mail sends to overlap.

Akagi
24 Feb 2006, 04:36
thanks for the reply. *installed*

Paul M
23 Mar 2006, 00:05
I just love this, we sent a newsletter to 5,500 of our members on Monday and I just sat back and watched as it gently went out over 10 hours. :)

kafi
06 Jun 2006, 10:48
I like the idea of this hack.

Additionally I would like to split sending out email by 1000 users (userid's) per day. Would this be possible?

I am afraid to send all at one day and then face loto fo support questions in that very day ... (that is my reason for to split newsletter)....

Thank you .-)

eytan
01 Aug 2006, 04:37
will this work for VB 3.6?

thanks

Paul M
01 Aug 2006, 10:29
will this work for VB 3.6?Yes.

psico
23 Oct 2006, 01:48
Now that vb 3.6 has been released, there will be no further updates to this modification.

Why?

Paul M
23 Oct 2006, 01:57
Because I only update & develop on the current version.

JFYI, As above, this runs quite happily on vb 3.6 anyway.