On 2021-11-06 06:15, li...@lazygranch.com wrote:
Most of my spam contains a gmail address to reply to the spammer. I would like to discard email whose body contains a gmail address. Since discarding mail could get ugly, I would hope someone on the list can eyeball my plan.
Indeed it is ugly. You just as well could have asked for a method to throw out the baby with the bathwater!
I added body_checks = pcre:/etc/postfix/body_checks to main.cf. I made a null body_checks file and ran postmap on it, then
postmap "compiles" hash: and other indexed map types. It's not needed for a pcre_table(5) map.
did a reload & restart. Postfix wouldn't send email if the file was missing. postconf -d mail_version mail_version = 3.6.2 Trawling the internet I found this regix to match gmail addresses: ^[\w.+\-]+@gmail\.com$ So if body_checks contained /^[\w.+\-]+@gmail\.com$/ DISCARD work.
Change DISCARD to WARN first, to see what it matches. Also, you anchored the expression on both ends, ^ and $, so you're only going to match mail with ONLY the gmail address on one line. This line with zeixsgw9gufv2isophpdyisr0bgz0...@gmail.com will not match. Neither will this, with the <> enclosing brackets: <zeixsgw9gufv2isophpdyisr0bgz0...@gmail.com> I think once you get the bugs worked out you will give up on this. See my postscreen howto for a much more effective means of dealing with spam. -- http://rob0.nodns4.us/