Viktor Ustiuhov via Exim-users wrote on 23.02.2025 12:30:
> Sławomir Dworaczek wrote on 23.02.2025 10:48:
>> heloo
>> great, it works
>>
>> condition = ${if and{{match{$h_X-Bogosity:}{\N(?i)^\s*Spam\N}}\
>> {bool{${lookup{$sender_address_domain}wildlsearch{/etc/exim/listy_acl/bogo_list}{false}{true}}}}}\
>>
>> {true}{false}}
> 
> ok
> 
> But there was a mistake in the last condition.
> Replace \$4 with \$1
> 
>> and what if I wanted to add a third condition?
>>
>> so that it checks if there is a domain OR address on the list?
>> after adding the line
>>
>> condition = ${if and{{match{$h_X-Bogosity:}{\N(?i)^\s*Spam\N}}\
>> {bool{${lookup{$sender_address_domain}wildlsearch{/etc/exim/listy_acl/bogo_list}{false}{true}}}}}\
>>
>> {bool{${lookup{$sender_address}wildlsearch{/etc/exim/listy_acl/bogo_list}{false}{true}}}}}\
>>
>> {true}{false}}
>>
>> Unfortunately, it is so that you have the desired messages from the
>> email address, but not necessarily the rest from that domain :)
>> e.g. all kinds of portals with food suppliers, you have notifications
>> about a purchase made from one address, but 10,000 ads are coming from
>> the entire domain :)
> 
> 
> 1. to exclude by only sender address
> 
> deny condition = ${if
> match{$h_X-Bogosity:}{\N(?i)^\s*Spam\b\N}{true}{false}}
>      condition =
> ${lookup{$sender_address}wildlsearch{/etc/exim/listy_acl/bogo_list}{${if
> eq{$value}{skip}{true}{false}}}{true}}


deny condition = ${if match{$h_X-Bogosity:}{\N(?i)^Spam\b\N}{true}{false}}
     condition =
${lookup{$sender_address}wildlsearch{/etc/exim/listy_acl/bogo_list}{${if
eq{$value}{skip}{true}{false}}}{true}}


> 1.1. to exclude sender domain domain.tld except sender address
> mailb...@domain.tld
> 
> /etc/exim/listy_acl/bogo_list:
> mailb...@domain.tld : skip
> *@domain.tld
> 
> 1.2. to exclude sender addresses mailb...@domain.tld and
> mailb...@domain.tld but not whole domain domain.tld
> 
> /etc/exim/listy_acl/bogo_list:
> mailb...@domain.tld
> mailb...@domain.tld
> 
> 
> 2. to exclude by sender address AND address from From: header
> 
> deny condition = ${if
> match{$h_X-Bogosity:}{\N(?i)^\s*Spam\b\N}{true}{false}}
>      condition = ${if and{\
> 
> {eq{${lookup{$sender_address}wildlsearch{/etc/exim/listy_acl/bogo_list}{${if
> eq{$value}{skip}{skip}{ok}}}{}}}{ok}}\
> 
> {eq{${lookup{${address:${sg{${sg{$rh_From:}{:}{\\\\:}}}{\N^\s*\S+@\S+\s*(<\S+@\S+>)\N}{\$1}}}}wildlsearch{/etc/exim/listy_acl/bogo_list}{${if
> eq{$value}{skip}{skip}{ok}}}{}}}{ok}}\
>                  }{false}{true}}


deny condition = ${if match{$h_X-Bogosity:}{\N(?i)^Spam\b\N}{true}{false}}
     condition = ${if and{\

{eq{${lookup{$sender_address}wildlsearch{/etc/exim/listy_acl/bogo_list}{${if
eq{$value}{skip}{skip}{ok}}}{}}}{ok}}\

{eq{${lookup{${lookup{${address:${sg{$rh_From:}{\N^\s*\S+@\S+\s*(<\S+@\S+>)\N}{\$1}}}}wildlsearch{/etc/exim/listy_acl/bogo_list}{${if
eq{$value}{skip}{skip}{ok}}}{}}}{ok}}\
                 }{false}{true}}


> 2.1. to exclude domain domain.tld except address mailb...@domain.tld
> 
> /etc/exim/listy_acl/bogo_list:
> mailb...@domain.tld : skip
> *@domain.tld
> 
> 1.2. to exclude mailb...@domain.tld and mailb...@domain.tld but not
> whole domain domain.tld
> 
> /etc/exim/listy_acl/bogo_list:
> mailb...@domain.tld
> mailb...@domain.tld
> 
> 
> 3. to exclude by sender address OR address from From: header
> 
> deny condition = ${if
> match{$h_X-Bogosity:}{\N(?i)^\s*Spam\b\N}{true}{false}}
>      condition =
> ${lookup{$sender_address}wildlsearch{/etc/exim/listy_acl/bogo_list}{${if
> eq{$value}{skip}{true}{false}}}{true}}
>      condition =
> ${lookup{${address:${sg{${sg{$rh_From:}{:}{\\\\:}}}{\N^\s*\S+@\S+\s*(<\S+@\S+>)\N}{\$1}}}}wildlsearch{/etc/exim/listy_acl/bogo_list}{${if
> eq{$value}{skip}{true}{false}}}{true}}


deny condition = ${if match{$h_X-Bogosity:}{\N(?i)^Spam\b\N}{true}{false}}
     condition =
${lookup{$sender_address}wildlsearch{/etc/exim/listy_acl/bogo_list}{${if
eq{$value}{skip}{true}{false}}}{true}}
     condition =
${lookup{${address:${sg{$rh_From:}{\N^\s*\S+@\S+\s*(<\S+@\S+>)\N}{\$1}}}}wildlsearch{/etc/exim/listy_acl/bogo_list}{${if
eq{$value}{skip}{true}{false}}}{true}}


> 3.1. to exclude domain domain.tld except address mailb...@domain.tld
> 
> /etc/exim/listy_acl/bogo_list:
> mailb...@domain.tld : skip
> *@domain.tld
> 
> 3.2. to exclude mailb...@domain.tld and mailb...@domain.tld but not
> whole domain domain.tld
> 
> /etc/exim/listy_acl/bogo_list:
> mailb...@domain.tld
> mailb...@domain.tld
> 
> 
> If you specify a value in the lines of the file
> /etc/exim/listy_acl/bogo_list with excluded addresses, for example, "ok"
> or "exclude" or another convenient value, then you can simplify the
> conditions.
> 
> 
>> regards
>>
>> ----- Original Message ----- From: "Viktor Ustiuhov via Exim-users"
>> <exim-users@lists.exim.org>
>> To: "Sławomir Dworaczek via Exim-users" <exim-users@lists.exim.org>
>> Sent: Sunday, February 23, 2025 3:02 AM
>> Subject: [exim] Re: please check the condition
>>
>>
>>> Sławomir Dworaczek via Exim-users wrote on 23.02.2025 2:06:
>>>> You're right, only 256 bytes can be in a file
>>>> Unfortunately, condition behaves as if it didn't work at all, all
>>>> emails, even those tagged spam, fall into inboxes
>>>> Regardless of whether they come from external or local domains
>>>>
>>>> This is a fragment of the SPAM header:
>>>> X-Bogofilterd: true
>>>> X-Bogosity: Spam, tests=bogofilter, spamicity=1.000000, version=1.2.5
>>>> and this is a fragment of the HAM header:
>>>> X-Bogofilterd: true
>>>> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.5
>>>
>>> to exclude by sender address domain:
>>>
>>> ${if and{\
>>>    {match{$h_X-Bogosity:}{\N(?i)^\s*Spam\N}}\
>>>
>>> {bool{${lookup{$sender_address_domain}wildlsearch{/etc/exim/listy_acl/bogo_list}{false}{true}}}}\
>>>
>>> }{true}{false}}
>>>
>>>
>>> to exclude by sender address domain and domain from From: header (does
>>> not work for multiple addresses in From: header):
>>>
>>> ${if and{\
>>>    {match{$h_X-Bogosity:}{\N(?i)^\s*Spam\N}}\
>>>
>>> {bool{${lookup{$sender_address_domain}wildlsearch{/etc/exim/listy_acl/bogo_list}{false}{true}}}}\
>>>
>>>
>>> {bool{${lookup{${domain:${sg{${sg{$rh_From:}{:}{\\\\:}}}{\N^\s*\S+@\S+\s*(<\S+@\S+>)\N}{\$4}}}}wildlsearch{/etc/exim/listy_acl/bogo_list}{false}{true}}}}\
>>>
>>> }{true}{false}}
>>>
>>>
>>>
>>>> If I change "if and" to "if or" it seems that searching in the domain
>>>> file works, but only searching, recognizing the header does not
>>>>
>>>> ${if or{\
>>>> {eqi{$h_X-Bogosity:}{Spam}}\
>>>> {bool{${lookup{$sender_address_domain}lsearch{/tmp/x.bogook}\{false}{true}}}}\
>>>>
>>>> }\ {yes it it spam}{no it is not spam}\}Greetings from Silesia-----
>>>> Original Message -----From: "Heiko Schlittermann via Exim-users"
>>>> <exim-users@lists.exim.org>To: "Sławomir Dworaczek"
>>>> <sla...@dworaczek.info>Sent: Saturday, February 22, 2025 11:09
>>>> PMSubject: [exim] Re: please check the condition>> --> ## subscription
>>>> configuration (requires account):>
>>>> ##https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/>
>>>>
>>>> ## unsubscribe (doesn't require an account):> ##
>>>> exim-users-unsubscr...@lists.exim.org> ## Exim details at
>>>> http://www.exim.org/> ## Please use the Wiki with this list -
>>>> http://wiki.exim.org/>
>>>>
>>>
>>>
>>> -- 
>>> Best wishes Viktor Ustiuhov
>>> mailto:vic...@corvax.kiev.ua
>>> public GnuPG/PGP key: https://victor.corvax.kiev.ua/corvax.asc
>>>
>>> -- 
>>> ## subscription configuration (requires account):
>>> ##
>>> https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
>>>
>>> ## unsubscribe (doesn't require an account):
>>> ##   exim-users-unsubscr...@lists.exim.org
>>> ## Exim details at http://www.exim.org/
>>> ## Please use the Wiki with this list - http://wiki.exim.org/
>>>
>>
>>
> 
> 


-- 
Best wishes Viktor Ustiuhov
mailto:vic...@corvax.kiev.ua
public GnuPG/PGP key: https://victor.corvax.kiev.ua/corvax.asc

-- 
## subscription configuration (requires account):
##   https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
##   exim-users-unsubscr...@lists.exim.org
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/

Reply via email to