Jump to content

Mailing out to 90k + users...


scooter41

Recommended Posts

Hi there,

 

I am trying to create a script for a client that has just over 90,000 users in a mysql database that they want to send out a monthly newsletter.

 

I am simply using a looping script from a mysql query, like the following:

 

while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) {             

sendmailer($row['email'],$numrows,$row['code1'],$row['code2']);

}

}

 

Then have a sendmailer function to sendout the html email they provide.

 

It seems to get to around the 27,000 figure fine then seems to stop sending out any further emails...

 

Do you think this is due to any kind of timeout, or perhaps an invalid data entry? if there a more gracefully / error trapping way of doing this?

 

Thanks for any help in advance

 

Scott

Link to comment
Share on other sites

thats sounds great..... the server techs have just come back with per minute stats too, so that would be handy to do, I didnt realise you could limit the speed of the script.....

 

What code do I need to look up to limit the number per hour?

 

Thanks for your help so far...

Link to comment
Share on other sites

its not limiting the script its a cron.. (looks at last post.. no idea why i said chown)..

 

basically the script will run every 1 minute..

so your need to log the position.. of the emails..

 

so maybe move the emails to another table (for safety and ease of use)

now for the emailing

something like

select * FROM temptable LIMIT 0,10

email them.. and then

delete FROM temptable LIMIT 0,10

 

this runs every 1 minute (read up on cron)

 

WARNING: this is just VERY QUICK and a basic idea.. THINK about what you want to do..

their probably a much better way

the reason for the 2nd table is because of the deletion (of course) but also it won't be updated by other scripts..

Link to comment
Share on other sites

sure, totally aware of cron tasks, I thought there was some special php function to limit the way the script runs......... I've just converted from perl to PHP so still very novice ;)

 

You are right, that idea would potentially work, but does sound a bit 'iffy'

 

I do however like the idea of moving the processed records from a queue to a complete table... at least then it would support resuming if the script falls over!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.