On Tue, Sep 30, 2008 at 05:19:05PM -0500, Lance Tagliapietra wrote: > Looking closer, exim is run by a cron task periodically, to try to > re-send email that could not be sent, or was queued for some reason. If > the message could not be delivered, it sits in the queue. Due to a > mis-configuration of exim, I had system messages to root sitting in > there, all the mail to support popularity-contest, and others, for about > 6 years! There were about 1000 files there to be processed, each time, > which simply took time. > [...] > Note that all this time I was able to send email/ receive email and > didn't really know about much system generated email.
You could run exim -d -qff <msgid> to see why those mails in the queue are failing. I suffered from a similar problem once and wrote a little Python script to deal with this problem. It tries to flush the queue and depending on the error code it gets back, it either tries to deliver the mail again, spool it again or simply delete it. If it can't send mails for a certain amount of time in the queue, it deletes the mail as well. The script is attached and as always: use it on your own risk! ;) -- Ciao... // Fon: 0381-2744150 Ingo \X/ http://blog.windfluechter.net gpg pubkey: http://www.juergensmann.de/ij_public_key.asc
#!/usr/bin/python # (c) 2003 by Ingo Juergensmann <ij (a) ${year}.bluespice.org> # License: GPLv2, see http://www.gnu.org/licenses/old-licenses/gpl-2.0.html # for details. import os from string import * import popen2 cmd = "mailq" r, w = popen2.popen2(cmd) while 1: line = r.readline() if not len(line): break print "!", line if count(line, "*** frozen ***"): msgid = split(line)[2] print "!! Examing MsgID", msgid, cmd2 = "exim4 -Mrm %s" % msgid os.system(cmd2) elif (count(line, "-") and (count(line,"<") and count(line,">"))): msgid = split(line)[2] try: timeout = int(replace(split(line)[0],"h","")) except: try: timeout = int(replace(split(line)[0],"m","")) except: try: timeout = int(replace(split(line)[0],"d","")) * 24 except: pass print "++", timeout, print "!! Examing MsgID", msgid print "!! Trying to deliver MsgID", msgid,"...", cmd2 = "exim4 -N -M %s" % msgid r2, w2 , e2= popen2.popen3(cmd2) while 1: line2 = e2.readline() #print "!!", line2 if len(line2)<1: break print "!!", line2, if (((count(line2, "(-19)") or count(line2, "(113)") or count(line2, "(110)") or count(line2, "(111)")) and timeout>=42) or count(line2, "(-44)") or count(line2, "(-1)") or count(line2, "(-42)")): cmd2 = "exim4 -Mrm %s" % msgid os.system(cmd2) print "!!! Message %s deleted." % msgid r2.close() w2.close() e2.close() r.close() w.close()