Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
3 capitalization; removed some extra wording
source | link

iI 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.

Thank you very much! (I'mI'm very inexperienced with RegEx, so I'm grateful for easy to understand answers).

Update: MyMy goal is to be able to list the addresses to be blocked simply under each other:

one@example.com
two@secondexample.net

In the procmailrc I'd have to do it that way:

:0:
* ^To.*one@example.com
/dev/null

:0:
* ^To.*two@secondexample.net
/dev/null

This is much more cumbersome for entering new addresses.

Best regards Peter

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.

Thank you very much! (I'm very inexperienced with RegEx, so I'm grateful for easy to understand answers)

Update: My goal is to be able to list the addresses to be blocked simply under each other:

one@example.com
two@secondexample.net

In the procmailrc I'd have to do it that way:

:0:
* ^To.*one@example.com
/dev/null

:0:
* ^To.*two@secondexample.net
/dev/null

This is much more cumbersome for entering new addresses.

Best regards Peter

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:

one@example.com
two@secondexample.net

In the procmailrc I'd have to do it that way:

:0:
* ^To.*one@example.com
/dev/null

:0:
* ^To.*two@secondexample.net
/dev/null

This is much more cumbersome for entering new addresses.

2 added 376 characters in body
source | link

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.

Thank you very much! (I'm very inexperienced with RegEx, so I'm grateful for easy to understand answers)

Update: My goal is to be able to list the addresses to be blocked simply under each other:

one@example.com
two@secondexample.net

In the procmailrc I'd have to do it that way:

:0:
* ^To.*one@example.com
/dev/null

:0:
* ^To.*two@secondexample.net
/dev/null

This is much more cumbersome for entering new addresses.

Best regards Peter

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.

Thank you very much! (I'm very inexperienced with RegEx, so I'm grateful for easy to understand answers)

Best regards Peter

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.

Thank you very much! (I'm very inexperienced with RegEx, so I'm grateful for easy to understand answers)

Update: My goal is to be able to list the addresses to be blocked simply under each other:

one@example.com
two@secondexample.net

In the procmailrc I'd have to do it that way:

:0:
* ^To.*one@example.com
/dev/null

:0:
* ^To.*two@secondexample.net
/dev/null

This is much more cumbersome for entering new addresses.

Best regards Peter

1
source | link

procmailrc-Killfile for recipient addresses?

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.

Thank you very much! (I'm very inexperienced with RegEx, so I'm grateful for easy to understand answers)

Best regards Peter