Just fyi, this particular topic keeps getting raised here. It'd be great if people would search the list archives. :)
One of the last times around: http://www.nabble.com/forum/ViewPost.jtp?post=21296293&framed=y In short, if you want to do this, write a plugin. REs are great until you get complicated, like doing multiple headers and comparing captured text. SA used to have a rule that looked for from=to, but it didn't do well and got removed. Some pointers in the above thread. On Fri, Mar 6, 2009 at 2:44 PM, Mark Martinec <mark.martinec...@ijs.si> wrote: > Adi, > >> First, it read the sender, and put it into a variable >> Then, it check, if the recipient is the same as that variable >> if true, then give score 3.0 > > The trick is to let a regexp see an entire mail header section. > Unfortunately it means we can't reuse already parsed addresses > in From and To header fields, but need to reparse it all in a regexp. > > The rules below comes close, but is not exact (the TOFROM rule > only checks the first To). Mind the line wraps, there are three > long lines, each starting by 'header': > > > header SAME_FROMTO1 ALL =~ m{^From: (?: . | \n[\ \t] )* <\s*(.+)\s*> (?s:.*) > ^To: (?: (?: "[^"]*" | \([^)]*\) | > [\ \t]+ | \n[\ \t]+ )*? \1 [,(\ \t\n] | (?: . | \n[\ \t])* <\s*\1\s*>)}mix > header SAME_FROMTO2 ALL =~ m{^From: (?: "[^"]*" | \([^)]*\) | [\ \t]+ | \n[\ > \t]+ )* ([^<>,;\s...@[0-9a-z._-]+\. > [a-z]{2,})\b (?s:.*) ^To: (?: (?: "[^"]*" | \([^)]*\) | [\ \t]+ | \n[\ \t]+ > )*? \1 [,(\ \t\n] | (?: . | \n[\ > \t])* <\s*\1\s*>)}mix > header SAME_TOFROM ALL =~ m{^To: (?: . | \n[\ \t] )* (?:\b|<) > ([^<>,;\s...@[0-9a-z._-]+\.[a-z]{2,}) \b (?!\.) > (?s:.*) ^From: (?: (?: "[^"]*" | \([^)]*\) | [\ \t]+ | \n[\ \t]+ )*? \1 [,(\ > \t\n] | (?: . | \n[\ \t])* > <\s*\1\s*>)}mix > meta SAME_FROMTO SAME_FROMTO1 || SAME_FROMTO2 || SAME_TOFROM > score SAME_FROMTO1 0.1 > score SAME_FROMTO2 0.1 > score SAME_TOFROM 0.1 > score SAME_FROMTO 1.5 > > > Mark >