2

I have a problem with backscatter to randomly generated fake-from-adresses on a domain with a catchall.

The fake-alias is using a scheme, using egrep with the regexp

^To:.*.[A-Z].[a-z].*[A-Z].[a-z].*[0-9]{2,5}@example.org.*

in my maildir lists all unwanted backscatter und luckily no address using this scheme is actually in use.

However, procmail is convinced that it does not match.

:0hD:
* ^To:.*.[A-Z].[a-z].*[A-Z].[a-z].*[0-9]{2,5}@example.org.*
!spam

procmail: No match on "^To:.*.[A-Z].[a-z].*[A-Z].[a-z].*[0-9]{2,5}@example.org.*"

I can't get procmail to interpret a regular expression like egrep (and other tools using regex's) does.

What am I doing wrong?

I found out that by default procmail ignores case, that's why I added "D" to the recipe. But I don't find any example with usage of [A-Z] in a procmail-recipes. Am I trying something impossible?

Christian
  • 201

1 Answers1

3

Procmail's regex dialect doesn't support the {m,n} repetition operator. You will simply have to spell out the pattern in longhand (maybe use a variable if it gets too massive).

:0D
* ^To:.*.[A-Z].[a-z].*[A-Z].[a-z].*[0-9][0-9]([0-9]([0-9][0-9]?)?)?@example\.org
!spam

As an aside, you should not use locking on a forwarding recipe, a trailing wildcard is useless, and the h flag is the default; so I took those things out.

tripleee
  • 3,308
  • 5
  • 36
  • 35