Ivotje50
Ivotje50

Reputation: 586

Endless php mail loop

I have a problem with an running script on my (VPS) php server. I have accidentally created an endless php mail() loop. (forgot to add one to $i). I believe it was something like this:

while($i<30){mail("me@gmail.com","Its me","Hi me!","Greetings"); }

I think i have terminated the script, but mails are still flooding my gmail-box. I tried deleting the file.php and restarting the server but after the restart emails started appearing again. I have ssh-access, but i do not have a clue how to stop emails from sending. Since i am not very good with command line access, can you provide some instructions?

Upvotes: 4

Views: 1637

Answers (2)

Ivotje50
Ivotje50

Reputation: 586

I ended up with logging in using SSH. I entered (as PeeHaa said) ps aux. About 20 postfix-processes came up. At this point, i killed all those processes with the command pkill -u postfix. Then i removed all the emails from the Queue using the method from Charlie S (postsuper -d ALL).

The emails stopped flooding, thanks guys!

Upvotes: 2

ZombieBunnies
ZombieBunnies

Reputation: 268

The script will self terminate based on the php.in time settings. If it [for whatever reason doesn't], just edit your php.ini, and restart your server from the web host manager.

Chances are the email flood is just ...... leftovers still coming in. lol The server can send a lot of emails before the auto script timeout is hit

Upvotes: 4

Related Questions