Wednesday, May 19, 2010

Postfix Sendmail clean mqueue

SkyHi @ Wednesday, May 19, 2010
Most mail servers will retry sending mail up to 5
days and then stop trying. Ideally they should delete the messages that
are not going to be delivered, but often that does not happen. To
delete the messages that are over 5 days old create and run the
following shell script or just run the command on
commandline.



Assumption: your mail q is located at /var/spool/mqueue



#!/bin/bash
#find /var/spool/mqueue -mtime +5 -exec ls -l {} \;

find /var/spool/mqueue -mtime +5 -exec rm -f {} \;