You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Rejaine Monteiro <re...@bhz.jamef.com.br> on 2014/08/28 15:45:33 UTC

A simple rule

In this example, I need to catch emails containing the word 'deputado' 
or 'presidente' in the message body. So..

body MYRULE     /deputado|presidente/i
score MYRULE    5.0

I did a test with a saved email that does _NOT_ contain any of the above 
expressions and he got the message.

spamc -R < sample.eml

pts rule name              description
---- ---------------------- 
--------------------------------------------------
  1.0 EXTRA_MPART_TYPE       Header has extraneous Content-type:...type= 
entry
  5.0 MYRULE
  0.0 HTML_MESSAGE           BODY: HTML included in message
  0.0 BAYES_50               BODY: Bayesian spam probability is 40 to 60%
                             [score: 0.5000]
  2.2 DCC_CHECK              Listed in DCC 
(http://rhyolite.com/anti-spam/dcc/)
  0.1 RDNS_NONE              Delivered to trusted network by a host with 
no rDNS

What i'm doing wrong??


Re: A simple rule

Posted by Bowie Bailey <Bo...@BUC.com>.
On 8/28/2014 10:12 AM, Kevin A. McGrail wrote:
> On 8/28/2014 10:05 AM, Axb wrote:
>> On 08/28/2014 03:45 PM, Rejaine Monteiro wrote:
>>> body MYRULE     /deputado|presidente/i
>> body MYRULE     /(?:deputado|presidente)/i
> Technically, Alex's rule is faster but not technically different.
>
> The ?: tells the regexp not to store any matches in $1, $2, etc.
>
> But otherwise, the ()'s are implied.
>
> I have to believe you are either A) running against a version of spamd
> that hasn't been restarted to reload the latest rule or B) the text
> appears somehow in the message.

Or C) the text appears as a substring.  Try this to avoid substring matches:

body MYRULE     /\b(?:deputado|presidente)\b/i

Shouldn't be an issue in this case, but is very important when trying to 
match shorter words.

-- 
Bowie

Re: A simple rule

Posted by "Kevin A. McGrail" <KM...@PCCC.com>.
On 8/28/2014 10:05 AM, Axb wrote:
> On 08/28/2014 03:45 PM, Rejaine Monteiro wrote:
>> body MYRULE     /deputado|presidente/i
>
> body MYRULE     /(?:deputado|presidente)/i
Technically, Alex's rule is faster but not technically different.

The ?: tells the regexp not to store any matches in $1, $2, etc.

But otherwise, the ()'s are implied.

I have to believe you are either A) running against a version of spamd 
that hasn't been restarted to reload the latest rule or B) the text 
appears somehow in the message.

Regards,
KAM

Re: A simple rule

Posted by Axb <ax...@gmail.com>.
On 08/28/2014 03:45 PM, Rejaine Monteiro wrote:
> body MYRULE     /deputado|presidente/i

body MYRULE     /(?:deputado|presidente)/i