Ravens PHP Scripts: Forums


View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> How To's
Author Message
Former Moderator in Good Standing

Joined: Aug 30, 2005
Posts: 3312
Location: near Albany NY

PostPosted: Thu Dec 15, 2005 3:21 pm Reply with quote

Yesterday I decided to use the Forum's mass email feature to email a Merry Christmas greeting (together with some info about the site) to all my users. After re-figuring out how usergroups worked in the Forums (the ability to add users to the groups being on the main Forum screen instead of in administration where I would expect it logically) I created a little email group with a few people in it to test the message. Then I modified the /modules/Forums/language/language_english/email/admin_send_email.tpl file to take out the standard boilerplate. So the test group worked fine and I tried the mailing to allusers. Nothing happened. No error, no email, no nothing. So I found out which programs were involved and started putting diagnostics into the /includes/emailer.php file which does the actual mailing. Humm, it was getting good to addresses and a good list of bcc's. The email header looked good too. I even echoed the message I was sending out and that was fine too. No errors in my log files, no nothing.

Puzzled, I corresponded with my server company, Ipowerweb. Here's the response I got:

You can add as many email addresses as you want but that will be sent as per our email sending limit. Please note our max email sending limit.
The limit on sending emails for vdeck servers is 100/hour. Plus, one can only send 5 emails per every 10 seconds. Please note the same.
This limit is server side and same even if the customer is using his own script or sendmail or php mail for sending out mass mails to users.
Thus for mass mailing the limits are:
vdeck - 100/hour
One can only send 5 emails every 10 seconds.

Oh well that won't work. Now, in the past I've used my ISP (Road Runner) for quasi mass emails but they limit the bcc field to 100 also. What I did to get around that was create a contact book and import the addresses in there and then run a mail merge generating individual messages for each user. But that's a p.i.t.a also. I wanted something that was fast and didn't involve much effort.

Having seen the bcc list in my diagnostics I got to thinking, I could do that too (I mean generate a list). So I wrote a little adhoc which you are free to copy, modify and improve:


   $cnt = "0";
   $sql = "SELECT user_email FROM ".$prefix."_users";
   echo $sql . '<BR>';
   $result = $db->sql_query($sql);
    $numrows = $db->sql_numrows($result);
    echo 'number of rows in user table = ' . $numrows . '<br>';
   while ($row = $db->sql_fetchrow($result)) {
      if ($cnt < 490) {      
   $bcc .=  $row['user_email'] . ', '; }
      else {
         $bcc2 .= $row['user_email'] . ', '; }
   } // end of while
   $bcc = trim($bcc,", ");
      $bcc2 = trim($bcc2,", ");
   echo $bcc;
   echo '<br><BR>';
   echo $bcc2;

Because I had problems including the db.php I just created my own in my adhocs directory with the following code:


$db = new sql_db($dbhost, $dbuname, $dbpass, $dbname, false);
if(!$db->db_connect_id) {
    die("<br><br><center><img src=images/logo.gif><br><br><b>There seems to be a problem with the MySQL server, sorry for the inconvenience.<br><br>We should be back shortly.</center></b>");


and I made a copy of mysql.php in the same directory. If you use another database you'll have to modify that.

But, you are no doubt asking, what good does that do if you have 807 users and your ISP limits you to 100 per email in the bcc. Well, I had recently signed up for a Google email and I checked with their help screens and they allow up to 500 in a bcc. That's why the counter in the program. I just dump the bcc's to the screen and then copy and paste them into a message (2 messages really) in Google and off she goes.

I did do some spelunking around the PHPbb site and forums and there are various hacks to split the mass email into chunks but nothing that would be workable with my server's limit. I guess that's what you get for $7.50 a month.

With this in place I can send a mass email in maybe 5 minutes plus whatever time it takes to write it. Of course if you have a better solution I'd love to hear it. I know: Raven's web hosting Smile and I may do that when my current contract expires.
View user's profile Send private message Visit poster's website
Sells PC To Pay For Divorce

Posts: 5661

PostPosted: Thu Dec 15, 2005 5:25 pm Reply with quote

Yes indeed....lol
I transfered a friend long ago from Ipowerweb to the host he's on now.
Its a shitty host...
But if you run a serious website you should use a serious host...
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> How To's

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
Forums ©