Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP Mail() function in a loop

Status
Not open for further replies.
Jul 14, 2003
116
CA
I am writing a script to send emails to about 100 users. I have been looking through the php.net description of Mail() and at the end I noticed that it said I shouldn't use this function in a loop. If I use a loop that cycles through 100 times is that too much for this function or am I okay?
 
The exact text of the online manual page reads, "is not suitable for larger volumes of email in a loop. This function opens and closes an SMTP socket for each email, which is not very efficient."

I don't think 100 users counts as a "larger volume of email", so long as you don't run the script too often. Of course, if you're using mail() on a unix-like OS, chances are that PHP is invoking your local sendmail command to send the emails, so the limit will be how many emails your script can send before your runtime limits take effect.


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top