Nuked mailserver without intension. Desperate help request!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Nemo
Forum Newbie
Posts: 3
Joined: Tue May 27, 2003 4:39 am

Nuked mailserver without intension. Desperate help request!

Post 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
?>
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

what email server? (OS, softwarename, version)
You're an admin of that server?
Nemo
Forum Newbie
Posts: 3
Joined: Tue May 27, 2003 4:39 am

Post 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?
sleepingdanny
Forum Newbie
Posts: 12
Joined: Thu Mar 20, 2003 4:27 am
Location: Israel

Post 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
Nemo
Forum Newbie
Posts: 3
Joined: Tue May 27, 2003 4:39 am

Post 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?
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post 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?
User avatar
Stoker
Forum Regular
Posts: 782
Joined: Thu Jan 23, 2003 9:45 pm
Location: SWNY
Contact:

Post 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
User avatar
phice
Moderator
Posts: 1416
Joined: Sat Apr 20, 2002 3:14 pm
Location: Dallas, TX
Contact:

Post 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++;
} 
?>
Image Image
User avatar
Stoker
Forum Regular
Posts: 782
Joined: Thu Jan 23, 2003 9:45 pm
Location: SWNY
Contact:

Post 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 ...
Post Reply