Showing results for 
Search instead for 
Did you mean: 

Help in clearing out /var/spool/mqueue

Go to solution
Viktor Balogh
Honored Contributor

Re: Help in clearing out /var/spool/mqueue


I think that the email was though delivered. See the next line...

Queued mail for delivery Sent
Unix operates with beer.
Super Advisor

Re: Help in clearing out /var/spool/mqueue

Hi Jose!

I think email delivery is now working, because I did receive that test mail, although this messages
>>(<> Queued mail for delivery)
says that perhaps mail has been put in a queue.
And also /var is decreasing, is now at 85% from 100%.

Dennis Handly
Acclaimed Contributor

Re: Help in clearing out /var/spool/mqueue

>So how to identify the contents of each message?

You have two files, one with the header (q) and the other the message (d):
-rw------- 1 root mail 1477 Mar 8 05:10 dfFAA16615
-rw------- 1 root mail 743 Mar 10 02:00 qfFAA16615

You could write some scripts to help you remove the multiple copies of messages.
This script does a search for useless messages and deletes the related files as a unit.

You should stop mail before running it:
/# sbin/init.d/sendmail stop

# create file_list with:
# fgrep -l "yyyy xxxxxxx" > file_list
# find . -name "qf*" -exec fgrep -l "Returned mail: see transcript for details"
+ > file_list
# find . -name "qf*" -exec fgrep -l "Warning: could not send message for past 4
hours" + > file_list

for file in $( < file_list); do
echo d$base q$base Q$base x$base
done | xargs -n1000 rm -f
Super Advisor

Re: Help in clearing out /var/spool/mqueue


what about this:
/var/spool/mqueue (15287 requests)
----Q-ID---- --Size-- -----Q-Time----- ------------Sender/Recipient------------
p2ABgwd16867 1545 Thu Mar 10 13:49 MAILER-DAEMON
p2ABgwc16867 1833 Thu Mar 10 13:44 MAILER-DAEMON

what is this Q-ID (p2ABgwd16867)?

This is the output of mailq command. Is this just information of files in queue?

Jose Mosquera
Honored Contributor

Re: Help in clearing out /var/spool/mqueue


Q-ID: *internal* identifier used on this host for the message.
#man mailq

#mailq -v|wc -l
This provide you the number of lines in the output of "mailq -v" command.
Try several times on reazonables intervals.
If this value increases without decrease your delivery service is down. By other hand, if decreases the sendmail service is dispatching.

If you check /var/adm/syslog/mail.log you can follow the sendmail service activity. Here you can see info about queued filename (eg: QAA05864), destinatary address, relay server used and delivery status of outgoing stat=Sent (OK id=1Pxi42-00045Y-Ih).

You can follow this activity on real time by:
#tail -f /var/adm/syslog/mail.log

Also you can see messages about dead.letter, this mean that sendmail service haven't way to delivery the message and create or append inside the source user homedir (eg: root, oracle) a plain text file named dead.letter, that contains the original message's header and body.

Steven E. Protter
Exalted Contributor

Re: Help in clearing out /var/spool/mqueue


What is the content of those two messages you are posting.

Normally the content can give some indication as to why they are in the queue.

You may have more information that you can process here and may need to clear the queue, make sure mail is flowing (It seems to be) and deal with new issues as they come up.

Steven E Protter
Owner of ISN Corporation
Super Advisor

Re: Help in clearing out /var/spool/mqueue

Hi all

Thank you for your contributions, I have already assign some points. I am closing the thread.