Page 1 of 1

Nuked mailserver without intension. Desperate help request!

Posted: Tue May 27, 2003 4:39 am
by Nemo
Greetings.

My script:

Code: Select all

<?php
$tolist = "nono@adress.at";
for ($i=0; $i<100; $i++) {
mail($tolist, "Newsletter", "Teurer Kunde, <br> wiedereinmal ist es soweit, bla bla...");
}
?>
was intendet to send 100 mails to my adress. But now its causing the Server to send endless amounts of this mail. :oops: My question now is not really what was wrong (eventhought I`d really like to know) but how can i stop the Server from sending more and more. Restarting Mailserver nor php server helped yet, how can the cache be deletet?

Thanks for any suggestions
?>

Posted: Tue May 27, 2003 5:34 am
by volka
what email server? (OS, softwarename, version)
You're an admin of that server?

Posted: Tue May 27, 2003 6:38 am
by Nemo
Sorry I`m not the admin, but it already stopped after sending over 7000 mails.
The question left now is, should the script shown as above send out 7000 mails?

Posted: Tue May 27, 2003 8:59 am
by sleepingdanny
I don't think that it suppose to that, but you can try using:

<?
$i=0;
$i++;
while($i<100){
mail($to,$subject,$message);
}
?>

This might work, but I don't sure. :P

Posted: Tue May 27, 2003 9:39 am
by Nemo
The problem is not to make it better, its rather the:
"Ikk! It wasn`t me because, ..."

Are there Server Configurations which might unintenedly call a script more than once?

Posted: Tue May 27, 2003 12:31 pm
by patrikG
This code

Code: Select all

<?php
$i=0;
$i++;
while($i<100){
mail($to,$subject,$message);
}
?>
will loop endlessly since $i doesn't increment in the loop.

The code you posted should loop exactly 100 times - that's it. Question is: what called that code and how often?

Posted: Tue May 27, 2003 2:01 pm
by Stoker
The reason it quit after 7000 was likely the default 30-second limit for PHP scripts...

I find it very odd that the code would loop to higher than $i == 99

Posted: Tue May 27, 2003 5:31 pm
by phice
Try:

Code: Select all

<?php 
$tolist = "nono@adress.at"; 
$i = 0;
while($i < 100) {
mail($tolist, "Newsletter", "Teurer Kunde, <br> wiedereinmal ist es soweit, bla bla...");
$i++;
} 
?>

Posted: Tue May 27, 2003 8:29 pm
by Stoker
I don't think he has any problems finding a way to do it, the question is rather how can

for ($i=0; $i<100; $i++) something

do 'something' forever, what is affecting $i ...