The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
[ HOME | TOPICS | INDEX | WEB RESOURCES | BOOKS | CONTRIBUTE | SEARCH | FEEDBACK | FAQ | FORUMS ]
Clearing out your sendmail queue 17 March 1999
Need more help on this topic? Click here
This article has 1 comment
Show me similar articles
This article tells you how to clear your outgoing mail queue.

I had a message that wasn't going away.  And I didn't want to wait for it to time out after the standard 5 days of trying.  Here's the message that was filling up my logs:

Mar 16 14:38:04 ns sendmail[20351]: VAA03402: to=akela@akela.ti.cz, 
                     delay=4+17:24:11, xdelay=00:01:16, mailer=esmtp
Mar 16 15:08:04 ns sendmail[20404]: VAA03402: to=akela@akela.ti.cz, 
                     delay=4+17:54:11, xdelay=00:01:16, mailer=esmtp
Mar 16 15:38:04 ns sendmail[20450]: VAA03402: to=akela@akela.ti.cz, 
                     delay=4+18:24:11, xdelay=00:01:15, mailer=esmtp

Every 30 minutes.  I was getting sick of it!  <grin>  So here's how I cleared it out:

# sendmail -bp

That will print a list of the mail queue.  Then you do manually remove the ones you want:

# cd /var/spool/mqueue
# rm <insert your file name here>
mailq
There's almost always more than one way to do something.  As Sue Blake point out to me with this command, which I had not heard of.  From the man page:
Mailq prints a summary of the mail messages queued for future 
delivery.

And as Sue pointed out, mailq is much easier to remember.

Here is a comparison of the output of the two commands.  For privacy reasons, I have changed the actual email address.

$ mailq
                Mail Queue (1 request)
--Q-ID-- --Size-- -----Q-Time----- ------------Sender/Recipient-------
WAB69608      747 Sun Jun 20 22:55 owner-freebsddiary-announce
                 (host map: lookup (somedomain.net): deferred)
                                   someone@somedomain.net
$ sendmail -bp
                Mail Queue (1 request)
--Q-ID-- --Size-- -----Q-Time----- ------------Sender/Recipient-------
WAB69608      747 Sun Jun 20 22:55 owner-freebsddiary-announce
                 (host map: lookup (somedomain.net): deferred)
                                   someone@somedomain.net

Need more help on this topic? Click here
This article has 1 comment
Show me similar articles