[Mossa på sten, Änggårdsbergen, Göteborg]

Howto check if an email address is beeing used.

Ok. This is quick and dirty but it works.

I have lots of domains and lots of email addresses. In the past I have used some of them and now I use others... On most of them I get only spam so I want to remove some of the old stuff. As I don't remember what addresses was used where I had to check my logs. I use Spam filtering to drop most of it but some get through. On most of them I get spam that is filtered out but the rest ends up in the same mailbox.

This is just a note of some of the script I used to find out if a particular address was used for something real. I have at least half a year of mail logs saved.

So first I checked the mail logs. I used this line to find all rows containing my email except the once that was in fact spam for sure. I.e. not even queued or discarded.

zgrep "yourname@example.com" mail.log*|grep -v NOQUEUE|grep -v discard|awk '{print $6}'|sed 's/://g' >/temp/yourname.txt

This gave me a list of queue numbers.

Second I processed the list again to match with the sender address.

for i in `cat /tmp/yourname.txt `; do zgrep $i /var/log/mail.log*|grep from >>/tmp/senders.txt; done

This gave me a list of addresses that had sent me email on that address.

Last was some cleaning up.

cat /tmp/senders.txt| sort -u |awk '{print $7}'|sed 's/from=<//g'|sed 's/>,//g'|sort -u|grep -v .com$|less

That gave me a clean list without doubles.

I ended up only finding one sane email sender. And now after that is fixed I can probably remove the alias completely minimizing the spam I have to handle.

Submitted by Erik on 2008-02-27 |