Re: [exim] Combine hosts/sender_domains in condition?

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Cyborg
Date:  
À: exim-users
Sujet: Re: [exim] Combine hosts/sender_domains in condition?
Am 08.09.21 um 09:31 schrieb MRob via Exim-users:
>
>> I'm not sure this is what you want but I have an "or" condition:
>>
>>     condition = ${if or{\
>>       {match{$mime_content_type}{(?i)executable}}\
>>
>> {match{$mime_filename}{\N(?i)\.(exe|com|vbs|bat|pif|scr|hta|js|cmd|chm|cpl|jsp|reg|vbe|lnk|dll|sys|btm|dat|msi|prf|vb)$\N}}\
>>
>>       }}
>> Here I use mime type and filename extension.
>
> I don't think you can put hosts or sender_domains in like that:
> ${if or{{hosts = ...}{sender_domains = ...}}}
>


Ofcourse not, you need to add those checks you need too:

or{
     {COND1}
     {COND2}
}

where COND can be one with FORANY/FORALL:

forany{<a list>}{<a condition>}

    These conditions iterate over a list. The first argument is expanded
    to form the list. By default, the list separator is a colon, but it
    can be changed by the normal method (6.21
    <https://www.exim.org/exim-html-current/doc/html/spec_html/ch-the_exim_runtime_configuration_file.html#SECTlistsepchange>).
    The second argument is interpreted as a condition that is to be
    applied to each item in the list in turn. During the interpretation
    of the condition, the current list item is placed in a variable
    called $item.


      *


        For forany, interpretation stops if the condition is true for
        any item, and the result of the whole condition is true. If the
        condition is false for all items in the list, the overall
        condition is false.


      *


        For forall, interpretation stops if the condition is false for
        any item, and the result of the whole condition is false. If the
        condition is true for all items in the list, the overall
        condition is true.


    Note that negation of forany means that the condition must be false
    for all items for the overall condition to succeed, and negation of
    forall means that the condition must be false for at least one item.
    In this example, the list separator is changed to a comma:


    ${if forany{<, $recipients}{match{$item}{^user3@}}{yes}{no}}


that way, you can parse those lists and combine the results in an OR . I
think MATCH or EQ are the compareoperators you need.


Best regards,

Marius