Tag Archives: mail server

Postfix queue management – list, debug and clean

Postfix mail server

 

Pstfix mail server and acomulate a queue of stuck emails, 
we monitor them via Nagios and sometime get alerts similar to this one,
there are some methods to take care of this queue:

 

msg_q = 17 warn=10 crit=20
WARNING: mailq is 17 (threshold w = 10)

log into the mail server and use the list command to see the mail queue:

mailq

-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
AAE603481BD 3471 Thu Oct 18 14:44:30  user@domain.com
(connect to outside.com[xxx.xxx.xxx.xxx]: Connection timed out)
user2@outside.com


the Q-id number is the id for the mail , you can read the mail to understnad what it is about and why its stuck with:

postcat -q AAE603481BD

you can delete it with:

postsuper -d AAE603481BD 

 

useful bash loop to delete all mails from do-not-reply@domain.com:

for i in $(mailq | grep -B1 'do-not-reply@domain.com'| grep '^[A-Z,0-9]'| awk '{print $1}')
do 
postsuper -d $i
done

 

 

Technorati Tags: , ,