php delay action?
- Started
- Last post
- 21 Responses
- xrusos
i'm looking to delay executing a mail() tag a few seconds without hindering the rendering of the html page it lies in.
any help?
- System-Idle0
I know of a delay in javascript.
could u use the time function in php.
php.net is always good to search
- xrusos0
thanks. I found the sleep() function. but that inhibits the rendering of the page - even when placed outside the html tags...
[/html]
[? sleep(); mail() ?]
- System-Idle0
would using a second php file to send the mail help.
- cosmo0
That should do the work, change 3 to watever u want.
- ldww0
what would this accomplish? sending a mail in php would not make the page load slower...
- cosmo0
but if u have like 5000 ppl on your mailing list, the server would time out after 500th one. So if u add delay of 3 sec's after every 500 / any number of email sent server won't time out.
- System-Idle0
it would stop any interference with the html loading
- cosmo0
System, the version of mailing List I have written is still a bit slow. Got about 2000 ppl on the mailing list, is there a way to make script faster.
- System-Idle0
are you pulling the addresses from a database
- cosmo0
yup.
- xrusos0
my problem is that my script is sending out multiple emails. i can't for the life of me figure out why.
my hope is to pause things a bit to see if the script is just getting over zealous.
- xrusos0
as in, multiple emails to the same address. - without being in any loop, if, else, for, etc.
- cosmo0
multiple emails? hmmm r u pulling emails out database?
If so just check for 'Distinct' emails and then send them out.
- cosmo0
show us your code xrusos.
- xrusos0
it's so bad that even this won't stop multiple emails sent to the same user:
if (!$mailsent) {
$mail($email, $subject, $body, $headers)
$mailsent="sent";
}what can i do?
- xrusos0
the site:
http://metrofreefi.com/wipod.php…loading for the first time yields between 2-4 emails.
reloading the submitted page yields only 1 email (correct!).
so why so many in the first round?
- xrusos0
cosmo... sent
- cosmo0
looking at it now.
- System-Idle0
if you dont mind having all the email addresses in the to sec you could create one fat var with all of them in and put that in the to sec
- DutchBoy0
"thanks. I found the sleep() function. but that inhibits the rendering of the page - even when placed outside the html tags...
[/html]
[? sleep(); mail() ?]
xrusos
(Dec 1 04, 08:42)"have you tried using an include?
although i am afraid it does not help as it parses the include tag before it loads, you have to try and see..