Tag Archives: qmail

May 9

  • Created: May 9, 2011 12:05 PM

Using qmail/qmqtool One Liners

qmail/qmqtool One Liners
Qmail is the mail client that comes with the control panel we use, Interworx. Qmail has its strengths and weaknesses, one drawback is there’s no easy built in way to view the messages in the mail queue. One of the ones tools that comes with Interworx ‘s qmail is qmqtool. I’ve found this tool very useful for working on mail queues and debugging problems and have developed a number of one liners to quickly diagnose problems.

<br />
# who are the top senders for the remote queue<br />
/var/qmail/bin/qmqtool -R | grep &quot;From: &quot; | sort  | uniq -c | sort -rn | head -20</p>
<p># who are the top recipients of the remote queue<br />
/var/qmail/bin/qmqtool -R | grep &quot;To: &quot; | sort  | uniq -c | sort -rn | head -20<br />
/var/qmail/bin/qmqtool -R | grep &quot;Envelope Recipient: &quot; | sort  | uniq -c | sort -rn | head -20</p>
<p># what are the top subjects of the remote queue<br />
/var/qmail/bin/qmqtool -R | grep &quot;Subject: &quot; | sort  | uniq -c | sort -rn | head -20</p>
<p># what domains are being sent the most mail from the server<br />
/var/qmail/bin/qmqtool -R | grep &quot;To: &quot; | cut -d @ -f2  | tr -d '&gt;' | sort | uniq -c | sort -rn | head -20<br />
/var/qmail/bin/qmqtool -R | grep &quot;Envelope Recipient: &quot; | cut -d @ -f2  | awk '{print $1}' | tr -d '&gt;' | sort | uniq -c | sort -rn | head -20</p>
<p># who are the top receivers for the local queue<br />
/var/qmail/bin/qmqtool -L | grep &quot;To: &quot; | sort  | uniq -c | sort -rn | head -20<br />
/var/qmail/bin/qmqtool -L | grep &quot;Envelope Recipient: &quot; | sort  | uniq -c | sort -rn | head -20</p>
<p># what domains are have the most mail in the local queue<br />
/var/qmail/bin/qmqtool -L | grep &quot;To: &quot; | cut -d @ -f2  | tr -d '&gt;' | sort | uniq -c | sort -rn | head -20<br />
/var/qmail/bin/qmqtool -L | grep &quot;Envelope Recipient: &quot; | cut -d @ -f2  | awk '{print $1}' | tr -d '&gt;' | sort | uniq -c | sort -rn | head -20<br />

Posted in: Linux / Tagged: , , ,