Monday, May 17, 2010

Not Just Another RKBA Blog

This blog was not intended to be RKBA all the time even though, lately, it seems that way. In that spirit here are a some simple bash scripts for email administrators who need to check mail the queue

See summaries for all mail for today
DATE=$(date|awk '{printf"%s %s\n",$2,$3}')
mailq|grep -A 2 "$DATE"

See subject lines for today's mail (root requried)
DATE=$(date|awk '{printf"%s %s\n",$2,$3}')
LIST=$(mailq|grep "$DATE"|sed -s 's/\([0-9A-F]*\).*/\1/')
for QUID in $LIST; do
  echo -n "$QUID: "
  postcat -q $QUID|grep -m 1 'Subject:'
done

View subject line in MAILER-DAEMON messages (root required)
LIST=$(mailq|grep MAILER|sed -e 's/^\([0-9A-F]*\) .*/\1/')
for QUID in $LIST; do
  echo -n "$QUID: "
  postcat -q $QUID|grep -m 1 "Subject:"
done

On my outgong gateway, almost everything in the queue from MAILER-DAEMON is a "Out of Office" notification not going back to a spammer. To delete these (root required and be careful with this one
mailq| grep MAILER|sed -e "s/^\([0-9A-F]*\) .*/\1/"|postsuper -d -

No comments:

Post a Comment

Off topic comments will be deleted. Comments with spelling or grammar errors may be deleted unless they have hoplophobic or statist content in which case they will be highlighted and ridiculed.

Note: Only a member of this blog may post a comment.