
08-11-10, 01:36 PM
|
 |
Member
|
|
Join Date: Aug 2010
Posts: 32
|
|
Sending e-mails in batches when using using PHP scripts For sending E-Mails
As we all understand that spamming, sending unsolicited emails is STRICTLY prohibited , so any hosting organization will not allow more
than the specified number of emails in an hour to be sent , the violation may result even to the extent of immediate deactivation of the Account involved in this.
So what can be done if we need to send large number of e-mails using PHP scripts without overshooting the maximum number of e-mails allowed to be
send in an hour ?????
Simply what we can do is send the e-mails in batches... Batches constituting of small number of emails, out of your entire sending list..
With some time interval between each batch..!
To achieve this please follow the following instructions..
( For example here we are taking the limit to send maximum number of e-mails allowed to sent in an hour is 300 ).
The first step is to find the configuration file for your phplist installation
Suppose you find it at location " /home/cPanelusername/public_html/list/config.php ".
Please edit the file using either cPanel File Manager ..
Or if you have shell access, open the file for editing in your favorite editor ( vi,nano or pico ).
Or download the file to your PC and edit using ( notepad, wordpad...etc)
Now look out for the section named "batch processing" in this file.
Here in you'll get code as :
Quote:
# define the amount of emails you want to send per period. If 0, batch
processing # is disabled and messages are sent out as fast as possible
define("MAILQUEUE_BATCH_SIZE",0);
# define the length of one batch processing period, in seconds (3600 is
an hour)
define("MAILQUEUE_BATCH_PERIOD",3600);
# to avoid overloading the server that sends your email, you can add a
little delay
# between messages that will spread the load of sending
# you will need to find a good value for your own server
# value is in seconds (or you can play with the autothrottle below)
define('MAILQUEUE_THROTTLE',0);
|
Now we'll edit these default settings to send the e-mails in batches
Quote:
# define the amount of emails you want to send per period. If 0, batch
processing # is disabled and messages are sent out as fast as possible
define("MAILQUEUE_BATCH_SIZE",0);
# define the length of one batch processing period, in seconds (3600 is
an hour)
define("MAILQUEUE_BATCH_PERIOD",3600);
# to avoid overloading the server that sends your email, you can add a
little delay
# between messages that will spread the load of sending
# you will need to find a good value for your own server
# value is in seconds (or you can play with the autothrottle below)
define('MAILQUEUE_THROTTLE',12);
|
These settings allows PHPList to throttle 300 mails per hour, exactly as TOS suggests. The remaining e-mails per domain remain available for normal mailing operations.
Save the file at correct location and you are done...
Or the other work around is..
Quote:
# define the amount of emails you want to send per period. If 0, batch
processing # is disabled and messages are sent out as fast as possible
define("MAILQUEUE_BATCH_SIZE",300);
# define the length of one batch processing period, in seconds (3600 is
an hour)
define("MAILQUEUE_BATCH_PERIOD",3600);
# to avoid overloading the server that sends your email, you can add a
little delay
# between messages that will spread the load of sending
# you will need to find a good value for your own server
# value is in seconds (or you can play with the autothrottle below)
define('MAILQUEUE_THROTTLE',12);
|
The MAILQUEUE_BATCH_SIZE can be any number less than or equal to 300.
This prevents your 12 second delay from sending over 300 per hour.
The MAILQUEUE_THROTTLE should be no less than 12, which allows up to 300 e-mails per hour.
(Every 8 seconds would limit me to 450 emails per hour. Every 9 seconds would limit me to 400 emails per hour. Every 10 seconds would limit me to 360 emails per hour.)
The MAILQUEUE_BATCH_PERIOD must be 3600.
So you'll not be having any problem meeting the the limits set be hosting providers for sending maximum number of e-mails per hour...
Even if your account is hosted on shared server !!!!
Last edited by ~Phil~; 08-11-10 at 01:45 PM.
|