0

I have set up a header filter in postfix to discard messages from Russia and Romania because of the volume of spam coming from those and we do not currently do business in those countries.

My regex looks like this

/^From:.*\@.*\.ro/     DISCARD

Problem is it is discarding messages containing .rodomainsomething like @email.roadrunnerrecords.com

How would I make it filter exact to TLD .ro?

Thanks.

sysadmin1138
  • 133,124
  • 18
  • 176
  • 300
  • 1
    You're doing spam filtering wrong if you're doing it this way. Something like SpamAssassin (or a commercial service like Postini) is a much better and more reliable choice... – voretaq7 Dec 12 '12 at 02:06
  • Thanks but I would like an answer about how to form the regex so that it only filters the TLD. I have spamassasin running. I want postfix to discard the message before it gets scanned. – Jesse Cain Dec 12 '12 at 14:08

2 Answers2

1

This is the regexp you need:

/^From:.*\@.*\.ro$/ REJECT

OTOH: I agree with the others that other solutions like content filtering are much better for this.

adaptr
  • 16,576
  • 23
  • 34
cstamas
  • 6,707
  • 25
  • 42
0
  1. You should really use a spam filter like Spamassassin for this.
  2. You should probably use REJECT instead of DISCARD.
  3. Like any computer program a regex will do what you say, not what you mean. To match a word boundary include it in the regex, e.g.: /\@.*\.ro\b/
mschuett
  • 3,146
  • 21
  • 21