Jump to content

Sending out emails in php... Best method and how often?


Nolongerused3921

Recommended Posts

I'm getting to the newsletter part of my site, and right now I have it setup to go through every 12 hours, go through and check which user wanted the daily/twice a day/weekly/etc. newsletter, and if the time has been met - add them to the mail queue table... This is all using my task manager*, and I would like to send out the mail using it as well, but I'm not sure what would be the best way.

I've been debating sending out 100 emails every 5 minutes, but I'm not sure if this is too much too soon, or if I can handle a few more. I'm also unsure of the best way to actually send these out, I can't decide if I want to use mail() or attempt to use SMTP... Which would be the best way, a way where it actually adds it to a queue rather then attempting to send them all at once, since this will be handled by my task manager.


*My task manager is pretty simple, and is loaded every time a user opens a page. It checks a database with a list of tasks, how often that task is supposed to run, as well as the last run time - and if it has been long enough, it opens the correct file and runs that task. So whatever method I chose, the user can't be stuck with 1.0+ second long script run time.
I also don't have to have access to server cronjobs to create a relatively on-time task.
Perhaps set it up to draw out the email addresses from your database into an array with mysql_query() right, then create a while loop to loop through the array 100 times or so and then sleep($x) x= amoutn of seconds to sleep for..then you will increment to the next, aka 101 and start again, sleeping at every multiple of 100 to allow your server to refresh itself...

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.