I want to block mails with certain recipient addresses using procmailrc (temporary addresses that now only receive spam).
I found a code sample for using a killfile/blacklist, but it only applies to sender addresses (FROM).
FROM=`formail -xFrom: | sed -e 's/ *(.*)//; s/>.*//; s/.*[:<] *//'` :0 * ? fgrep -qxis $FROM $PMDIR/killfile /dev/null
How can I adapt this code so that it applies to recipient addresses (TO)? It would be really great to simply be able to list the unwanted recipient addresses in the text file.
I'm very inexperienced with RegEx, so I'm grateful for easy to understand answers.
My goal is to be able to list the addresses to be blocked simply under each other:
In the procmailrc I'd have to do it that way:
:0: * ^To.*firstname.lastname@example.org /dev/null :0: * ^To.*email@example.com /dev/null
This is much more cumbersome for entering new addresses.