There's commercial/free products like Amavis, Sophos, AVP and Inflex for e-mailscanning, have a look at the (still authoritative?) Linux AV FAQ at
http://www.cn.is.fh-furtwangen.de/~l...v-linux_e.txt.
Free stuff to sort/prune/cleanse based on content also includes packages like renattach and the Perl::milter stuff, just do a search on "mail sanitizing" or "mail content filtering".
HTH