You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Pedro David Marco <pe...@yahoo.com> on 2016/11/08 04:39:55 UTC

Define new variables in local.cf

Hi!
When you the same string repeated many times in a .cf file   is it possible to use any kind of user-defined variable or constant to avoid repetition and make it easier to maintain?
thanks!
-----Pedro

Re: Define new variables in local.cf

Posted by Dave Wreski <dw...@guardiandigital.com>.
Hi,

> having the regex into a variable would help maintenance. Something like:
>
> $BankList = "Bank1|Bank2|Bank3|Bank4"
>
> uri       BANKURI      /$BankList/i
> score   BANKURI    0.2
>
> body   BANKBODY     /$BankList/i
> score   BANKBODY    0.1
>
> is there any way to do this?

You might try something like this:

body	__BANK1	/Bank1/
body	__BANK2	/Bank2/
body	__BANK3	/Bank3/
meta	BANKBODY	(__BANK1 || __BANK2 || __BANK3 >= 1)
score	BANKBODY	0.1

uri	__BANKURI1	/bank1\.com/
uri	__BANKURI2	/bank2\.com/
uri	__BANKURI3	/bank3\.com/
meta	BANKURI		(__BANKURI1 || __BANKURI2 || __BANKURI3 >= 1)
score	BANKURI		0.1

If you'd like to be able to use variables, like $BankList, I would 
create a script that writes out the spamassassin cf file to the 
spamassassin rule directory.

Regards,
Dave

Re: Define new variables in local.cf

Posted by Pedro David Marco <pe...@yahoo.com>.
Suppose i have these 2 rules:
uri       BANKURI      /Bank1|Bank2|Bank3|Bank4/iscore   BANKURI    0.2
body   BANKBODY     /Bank1|Bank2|Bank3|Bank4/iscore   BANKBODY    0.1
having the regex into a variable would help maintenance. Something like:
$BankList = "Bank1|Bank2|Bank3|Bank4"
uri       BANKURI      /$BankList/i
score   BANKURI    0.2
body   BANKBODY     /$BankList/iscore   BANKBODY    0.1
is there any way to do this?
Thanks!
--------Pedro

      From: Matus UHLAR - fantomas <uh...@fantomas.sk>
 To: users@spamassassin.apache.org 
 Sent: Tuesday, November 8, 2016 11:09 AM
 Subject: Re: Define new variables in local.cf
  
On 08.11.16 04:39, Pedro David Marco wrote:
>When you the same string repeated many times in a .cf file   is it possible
> to use any kind of user-defined variable or constant to avoid repetition
> and make it easier to maintain?

any example of what you mean?


-- 
Matus UHLAR - fantomas, uhlar@fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
Linux is like a teepee: no Windows, no Gates and an apache inside...


   

Re: Define new variables in local.cf

Posted by Matus UHLAR - fantomas <uh...@fantomas.sk>.
On 08.11.16 04:39, Pedro David Marco wrote:
>When you the same string repeated many times in a .cf file  is it possible
> to use any kind of user-defined variable or constant to avoid repetition
> and make it easier to maintain?

any example of what you mean?


-- 
Matus UHLAR - fantomas, uhlar@fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
Linux is like a teepee: no Windows, no Gates and an apache inside...

Re: Define new variables in local.cf

Posted by Pedro David Marco <pe...@yahoo.com>.
Great!
Thanks!
--------Pedro.


      From: RW <rw...@googlemail.com>
 To: users@spamassassin.apache.org 
 Sent: Tuesday, November 8, 2016 7:15 PM
 Subject: Re: Define new variables in local.cf
   
On Tue, 8 Nov 2016 04:39:55 +0000 (UTC)
Pedro David Marco wrote:

> Hi!
> When you the same string repeated many times in a .cf file   is it
> possible to use any kind of user-defined variable or constant to
> avoid repetition and make it easier to maintain? thanks! -----Pedro

See

https://spamassassin.apache.org/full/3.4.x/doc/Mail_SpamAssassin_Plugin_ReplaceTags.html

   

Re: Define new variables in local.cf

Posted by RW <rw...@googlemail.com>.
On Tue, 8 Nov 2016 04:39:55 +0000 (UTC)
Pedro David Marco wrote:

> Hi!
> When you the same string repeated many times in a .cf file   is it
> possible to use any kind of user-defined variable or constant to
> avoid repetition and make it easier to maintain? thanks! -----Pedro

See

https://spamassassin.apache.org/full/3.4.x/doc/Mail_SpamAssassin_Plugin_ReplaceTags.html