Rapitharian wrote:
> 
> 
> RW-15 wrote:
>> 
>> On Fri, 20 May 2011 06:41:33 -0500
>> Daniel McDonald <dan.mcdon...@austinenergy.com> wrote:
>> 
>>> 
>>> 
>>> 
>>> On 5/19/11 7:55 PM, "Rapitharian" <rapithar...@hotmail.com> wrote:
>>> 
>>> > 
>>> > RW-15
>>> > Can you help me some?  I am not even a novice in writing/reading
>>> > regular expressions.
>>> > What is this doing? X-Relay-Countries=~
>>> > /^([^[:alpha:]]*(GB|US)[^[:alpha:]]*)+$/
>>> 
>> 
>>> Since the non-alpha characters will always be a single space, and
>>> there is never a space in the first column, this would be more easily
>>> written as: /^(?:(?:GB|US)\s?)+$/
>> 
>> [^[:alpha:]]* doesn't just match single spaces, it also matches the **
>> characters. I wrote it that way on the off-chance that additional
>> special codes might be added in the future. For example if ?? were
>> added to represent IPv6 addresses, they would be ignored by my rule,
>> but /^(?:(?:GB|US|\*\*)\s?)+$/ would treat ?? as if it were a foreign
>> country code.
>> 
>> 
>> 
>> BTW does anyone know if there's a way to get the FreeBSD p5-IP-Country
>> port to update its database. I just noticed it's nearly two years old.
>> 
>> 
>> 
> 
> RW-15,
> Something seems wrong.  I placed the following rule in my spamassassin
> local.cf file.  It is only hitting on the countries I want to exclude. CA,
> FR, GB,KY, and US.
> 
> header                __RELAYCOUNTRY_SENSIBLE X-Relay-Countries=~
> /^([^[:alpha:]]*(CA|FR|GB|KY|US)[^[:alpha:]]*)+$/ 
> describe      __RELAYCOUNTRY_SENSIBLE Relayed through a Spammy Country
> score         __RELAYCOUNTRY_SENSIBLE 1.0
> 
> Should I change the above to below to correct?
> 
> header                __RELAYCOUNTRY_SENSIBLE X-Relay-Countries!~
> /^([^[:alpha:]]*(CA|FR|GB|KY|US)[^[:alpha:]]*)+$/ 
> describe      __RELAYCOUNTRY_SENSIBLE Relayed through a Spammy Country
> score         __RELAYCOUNTRY_SENSIBLE 1.0
> 
> The key difference is I exchanged the = for a !.  This should make this
> rule a negative rather than a positive match, correct?
> Again I thank you all for your help.
> Rap
> 

I had to make one more change to get this to work, I had to remove the space
after the !~.
Here is the final working code:
header RELAYCOUNTRY_SENSIBLE
X-Relay-Countries!~/^([^[:alpha:]]*(CA|FR|GB|KY|US)[^[:alpha:]]*)+$/ 
describe RELAYCOUNTRY_SENSIBLE Relayed through a Spammy Country
score   RELAYCOUNTRY_SENSIBLE 1.0

Thanks to everyone for there help getting this to work.  Now every time an
email relays through a country not in my very short acceptable list it gets
tagged with a point.  Not as fine grained control as the normal method, but
a much easier way to wack all countries not explicitly called out.

Thanks Again,
Rap
-- 
View this message in context: 
http://old.nabble.com/RelayCountry-Plugin-tp31652314p31673280.html
Sent from the SpamAssassin - Users mailing list archive at Nabble.com.

Reply via email to