You are here: Re: [PHP] Mail function « PHP « IT news, forums, messages
Re: [PHP] Mail function

Posted by Richard Lynch on 09/27/55 11:16

On Tue, May 17, 2005 3:53 pm, virtualsoftware@gmail.com said:
> I have a script which send emails using mail() function. I have 100 email
> addresses and i set up the script to send 1 email every 10 seconds. So, it
> will take 1000 seconds
> to send all 100 emails.
>
> My question is: If I stop the script after,let's say 12 seconds, it will
> send only 1 email or all 100?I mean it is possible that the server to
> cache all emails and send them if i stop the script? I must say that the
> script is run through a web browser.

If you stop the script before PHP executes the instruction to send the
email, then the email ain't gonna go out. Period.

Your best bet would be to use PHP to QUEUE the emails up, and let your
mail sending software (sendmail, qmail, elvenmail) worry about load and
timing.

You may also want to consider having the web-based application simply set
a flag/indicator somewhere which tells PHP that it's time to queue up all
100 emails. Then the end user won't even have to wait for 100 emails to
get queued up in line. They only have to wait for the flag to get set
which should take, like, less than one second.

There are also innumerable PHP mail classes "out there" to make sending
email easier. http://phpclasses.org has some, I'm betting PEAR has some,
and you could Google and find a thousand more.

--
Like Music?
http://l-i-e.com/artists.htm

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация