Re: Mail function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 17, 2005 3:53 pm, virtualsoftware@xxxxxxxxx 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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux