Wednesday, October 30, 2013

scanning exim frozen mails for spam

I had a bunch of frozen emails. I wanted to be sure there was no spam. I did this command:

exim -bp | awk '{if ($3!="") {print "newMessage"; system("exim -Mvb " $3) } }' | awk 'BEGIN{RS="newMessage"} !/different string|I do not want|to include inside|mails/{print $0}' | less

So I ignore mails containing certain words and remain only with those strange mails.

I discovered I had sent no spam, but instead I had received undeliverable mail which mas kept frozen.

Thursday, October 17, 2013

exim commands

Delete queue:

sudo exim -bp | awk '{print $3}' | xargs exim -Mrm

extracting mailing script out of exim queue, using awk

This is a nice command I came to:

exim -bp | awk '{ if ($3 neq '') system("exim -Mvh " $3) }' | grep Script | awk '{ print $3}' | sort

It prints the scripts of my server that have send mail.

It is also useful the mail.log php directive, that logs a lot of information of every script that send mail with mail() in php.