[Exim] contrib: 2 scripts for mailq

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Thomas Baumann
Datum:  
To: exim-users@exim.org
Betreff: [Exim] contrib: 2 scripts for mailq
Hello list,

I perform a freeze in my acl_check_content for messages that have been
identified as spam. To decide for unfreeze or deliver I have to look at
my spooldirectory for the subject line. So I wrote a script for
Showing me the Subject of each frozen message.

Have fun!

usage: mailq_frozen | cut -c1-${COLUMNS}

#!/bin/sh
# shows current frozen mails in mailq with their
# spamassassined New-Subject line
# 2003-10-20 Thomas Baumann <tom@???>

MAILQ=`which mailq`
AWK=`which awk`
EXIMQDIR=/var/spool/exim/input

${MAILQ} | \
${AWK} 'BEGIN {FS="\n"; RS=""} \
    /\*\*\* frozen \*\*\*/ \
    { RCPT=""; for (i=2; i<=NR; i++) \
            {a=$i; gsub(/ /,"",a); RCPT=RCPT";"a;} \
            {RCPTS=gensub(/;*$/,"",g,RCPT); RCPTS=gensub(/^;*/,"",g,RCPTS); \
             max=split(sprintf("%s \n",$1),line," "); \
             printf "%s (%s) %s %s\n",line[3],line[1],line[4],RCPTS } \
    }' | \
while read tmp
do
        MSGID=`echo $tmp|awk '{print $1}'`
        # Show MSGID (IN_QUEUE_SINCE) SENDER RECIPIENTS
        echo $tmp
        # Show SUBJECT from MSGID
        ${AWK} '/X-New-Subject:/ \
            {SUBJ=gensub(/X-New-Subject:/,"",g,sprintf("%18s## %s ##","",$0)); \
             print SUBJ}' \
            ${EXIMQDIR}/${MSGID}-H
done



PS.
If you modify the     /\*\*\* frozen \*\*\*/ \    line,
then you can use this little script for showing the subject
for all messages in the queue or another regex.


--
Thomas Baumann // tirili+list.exim@???