On Fri, 2010-06-18 at 16:38 +0200, Massimiliano Giovine wrote: > Thanks for the answer: > I also put 25_myplugin.cf where other plugin's confs are.
Don't. This will be lost on the next successful sa-update run. Instead, use your site config dir for the custom cf file. > if loadplugin myplugin > header MY_RULE eval:check_header_token() > endif That doesn't even lint. The loadplugin command is for actually loading the plugin, which must be done prior to using it in rules. The conditional should be ifplugin. Grep the stock rules for example usage. And btw, the conditional is only necessary, if the plugin might not be enabled -- if you know you load it, there isn't much need to guard the rules... > but it does not change spamassassin behaviour. > My plugin will be more complex and will do analysis of mail customized > headers. I'm trying to make just an example. OK then. However, is the custom header analysis going to be that complex, that a bunch of header and probably meta rules would not do? > I read that docs thousand times but i never found the answers i need. > I have one more question: > when my eval rule is called? When the corresponding rule is being evaluated. Hint: dbg() lines in your plugin can help a lot. Observe your plugin's behavior by calling spamassassin -D. > i suppose this flow: > 1) telnet an email with particular header > 2) spamassassin(spamd not command line execution) calls my eval rule spamd must be restarted. And of course, your cf file must lint cleanly... > 3) the rule hitted (return 1) the message is deleted: the mail won't > be writed into /var/mail/mailbox. Wrong. SA does NOT deliver mail. SA does NOT prevent delivering mail, neither delete mail. SA evaluates a score. Any action whatsoever is the responsibility of other tools in your mail processing chain. Oh, and since you defined a single eval() rule, the resulting score will just be changed by the rule's score. Whether the overall score exceeds the spam threshold or not is another question. What you just outlined is a single-hit kill-switch. While you /can/ do that with SA, you will not find it in stock rules. SA is a scoring system. (And again, performing action based on the kill-switch rule is outside the scope of SA.) And since you just mentioned "return 1", but didn't get back to all my comments -- the logic in the OP still is reversed. The rule hits, when the Subject does not match your criteria. -- char *t="\10pse\0r\0dtu...@ghno\x4e\xc8\x79\xf4\xab\x51\x8a\x10\xf4\xf4\xc4"; main(){ char h,m=h=*t++,*x=t+2*h,c,i,l=*x,s=0; for (i=0;i<l;i++){ i%8? c<<=1: (c=*++x); c&128 && (s+=h); if (!(h>>=1)||!t[s+h]){ putchar(t[s]);h=m;s=0; }}}