title: Clear MAMP (postfix?) Mail Queue on Mac OS X 10.6 / PHP Mail() Loop Failure
body: <p>I guess it serves me right, but I was testing a looping mail script that was designed to send an email to a friend every minute (for a set period of time) just to annoy them. (A reminder for a forgetful person)</p>
  
  <p>I was testing it on myself to see if it would work and in the process set an infinite loop, and emailed myself an unknown number of times. It was on my localhost using MAMP Pro.</p>
  
  <p>The accident looked like this</p>
  
  <pre><code>&lt;?php
  while (1){
  $to = "me@me.com";
  $subject = "The Subject";
  $message = "The Reminder.";
  $from = "me@me.com";
  $headers = "From:" . $from;
  mail($to,$subject,$message,$headers);
  echo "The End.";
  }
  ?&gt;
  </code></pre>
  
  <p>I ran the script and left it in the browser for about 40 seconds while having a mind blank, since then I've received about 800 or more emails in my spam folder before turning off MAMP.</p>
  
  <p>I'm wondering how I can clear the queue that it's made. (While MAMPs off no new spam emails are received, when MAMPs on it starts again)</p>
  
  <p>In terminal <code>sudo postqueue -p</code> will give me long the list however <code>postfix -f</code> / <code>postfix flush</code> etc produce </p>
  
  <blockquote>
    <p>postqueue: fatal: Cannot flush mail queue - mail system is down</p>
  </blockquote>
  
  <p>postsuper -p gives me </p>
  
  <pre><code>postsuper: fatal: use of this command is reserved for the superuser
  </code></pre>
  
  <p>sudo postsuper -d and one ID will delete a message but I can't delete all.</p>
  
  <hr>
  
  <p>EDIT/UPDATE </p>
  
  <p>ANSWER:</p>
  
  <p>I should have kept fiddling.</p>
  
  <p>sudo postsuper -d ALL
  Is the winner resulting in 385 messages deleted</p>
  
  <p>That could have been annoying.</p>
  
  <p>Serves me right for trying to play a practical joke I didn't fully understand.</p>