I'm testing a moderately high volume (eventually possibly up to 100,000 or so) of emails in a script I'm writing. I'm generating a list of emails that will end up in one of my accounts and having the script process them, and it's working pretty well, but for right now I just want to make sure sendmail is receiving the right number of requests without actually sending any mail.
I've got sendmail turned off and when I run the script I get the expected number of requests in the deferred queue (when I run mailq I get the right number of requests marked "(Deferred: Connection refused by [127.0.0.1])").
I know if I had sendmail running and wanted to delete the messages that were actually queued I could delete the contents of /var/spool/mqueue (I'm on an Ubuntu 10.04 LTS machine). However with sendmail turned off there's nothing in mqueue, and when I turn sendmail on it starts to send all of those emails, I can't delete them from mqueue as fast as sendmail processes them.
Is there any way for me to delete them from the backlog with sendmail turned off so I don't accidentally send some? Right now if they get sent it's no big deal (again they all end up in my mailbox), but I would like to test it with an actual set of test data, and it's important that those emails not get inadvertently spammed.
Sendmail transfers the mails to queue once they've been treated, so if sendmail is off they can't go to mqueue on time as you're experiencing.
Check
/var/spool/clientmqueue
which is where sendmail stores the e-mails before forwarding them over, that should do the trick for you ;)