sending 5000 mass email with php

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
genux33
Forum Newbie
Posts: 18
Joined: Sun Apr 10, 2005 8:22 am

sending 5000 mass email with php

Post by genux33 »

hi ,
what is the reasonable way to send mass email using php. i saw thread mentioning that the mail() function in PHP for anything over 100 mails, not even using it by breaking out your recipients in batches of 25, 50, 100 etc. and looping with the function?
any advise?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

The mail function could handle it if you set the time limit to zero and providing your ISP permits it....

BUT why so many?
genux33
Forum Newbie
Posts: 18
Joined: Sun Apr 10, 2005 8:22 am

Post by genux33 »

d11wtq wrote:The mail function could handle it if you set the time limit to zero and providing your ISP permits it....

BUT why so many?
where did u set time limit to zero??? currently my company hosting the server.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

set_time_limit()
mail()
foreach() loops

All the help you need is on http://www.php.net/

Still not sure why you need to send so many?
Sphen001
Forum Contributor
Posts: 107
Joined: Thu Mar 10, 2005 12:24 pm
Location: Land of the Beaver

Post by Sphen001 »

If you need to send so many emails, the best way would be to break it up into sections. It might be useful to write a few functions to handle this for you.

Sphen001
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

The recommended way is to have all the emails needing to be emailed set in a database (proving you have a unique id column, and a flag column to differenciate sent emails and pending emails).

You can then use a cron job if your on linux systems, or task manager on windows.
Have it set to run your email file every 5-10 mins or so, the longer you wait the better.
So now as you loop through lets say 50 emails, set their flag to sent and then in the next 5-10 min it will loop through again, and again, until no more emails are pending.
Post Reply