Hire a web Developer and Designer to upgrade and boost your online presence with cutting edge Technologies

Monday, July 22, 2013

Exim Remove All messages From the Mail Queue

Question:

 I'm using Exim mail server under CentOS Linux. How do I remove all messages from the Exim mail queue using a shell prompt?

Answer:
Exim is a mail transfer agent (MTA) used on Unix-like operating systems. It aims to be a general and flexible mailer with extensive facilities for checking incoming e-mail.

To print a list of the messages in the queue, enter:

# exim -bp

To remove a message from the queue, enter:

# exim -Mrm {message-id}

To remove all messages from the queue, enter:

# exim -bp | awk '/^ *[0-9]+[mhd]/{print "exim -Mrm " $3}' | bash
Dallas Marlow, suggested following clean command:
# exim -bp | exiqgrep -i | xargs exim -Mrm
DELETE FROZEN MAILS
/usr/sbin/exim -bp | awk '$6~"frozen" { print $3 }' | xargs /usr/sbin/exim -Mrm
REMOVE MAILS FROM SENDER
/usr/sbin/exiqgrep -i -f (MAIL ADDRESS HERE) | xargs /usr/sbin/exim -Mrm 
OR 
/usr/sbin/exim -bp | awk '$4~"info@domain.com" { print $3 }' | xargs /usr/sbin/exim -Mrm

No comments:

Post a Comment