Click to See Complete Forum and Search --> : Email to 1000's of people in DB?


sanchez_1960
12-01-2006, 11:37 AM
Basically in order to run multiple emails to users, i'm using the php mail function within a loop. However, on my windows machine it is slow to say 10 contacts. I'm concerned that when uploaded to a dedicated linux server, it'll have have serious problems.

Is the loop approach the wrong way?

legendx
12-01-2006, 11:44 AM
you could loop all the email addresses into a string seperated by , and use mail() only once.

So it would look like

mail("user1@mail.com, user2@mail.com, user3@mail.com", "subject", "message");

Not sure if this is better or worse than your method, its just another way of doing it.

NogDog
12-01-2006, 12:30 PM
PHP's mail() function would be very inefficient for something like that. You should probably look at the Pear::Mail (http://pear.php.net/package/Mail) and/or Pear::Mail_Queue (http://pear.php.net/package/Mail_Queue) packages.

Meni
12-01-2006, 12:52 PM
If time is not a factor and all you are concerned about is the time it would take for the page to run the script, you could always submit every mail to a temporary table in your DB and then run a cron that would run the mail() function in the back one by one, or loop through the whole thing.

I wouldn't go with legendx's option because most spam filters would consider such an approach as spam and would get rid of your message.