Re: [exim] forany() with multiply recipients

Góra strony
Delete this message
Reply to this message
Autor: ROGERS Richard M
Data:  
Dla: 'exim-users@exim.org'
Temat: Re: [exim] forany() with multiply recipients
> If someone knows a way to have Exim go through the delivery ACL rules for
> each
> recipient, I'd like to know.
>
> -- Chris
>
> --
> Chris Knadle
> Chris.Knadle@???


Delivery ACL? Am I missing something, or have you not accepted the message anyway by then?

We defer at the RCPT ACL stage - not enforcing a separate delivery per recipient, but a separate delivery per preference (this is OK as long as the number of different preferences is reasonably small! And most people use default anyway...). It works like this...

# Use macros to define these ACL variable names 
#
ACL_USER_PREFS_MODE     = acl_m0
ACL_RCPT_EXEMPTION_MODE = acl_m2
ACL_MSG_EXEMPTION_MODE  = acl_m3


...

In the RCPT ACL, early on, get the user preferences from a database (the names here are not necessarily the best but you will get the idea)...

warn    set ACL_USER_PREFS_MODE = ${readsocket{/var/run/exim_white_sockd.sock}{WHITELIST ${lc:$sender_address} ${lc:$local_part@$domain} $sender_host_address}{3s}{\n}{0}}


(then set ACL_RCPT_EXEMPTION_MODE according to ACL_USER_PREFS_MODE)
...

# If this is the first recipient, the message exemption mode will be unset -
# in this case, set the message exemption mode to be
# the same as the recipient exemption mode

warn    condition = ${if def:ACL_MSG_EXEMPTION_MODE {no}{yes}}
        set ACL_MSG_EXEMPTION_MODE = $ACL_RCPT_EXEMPTION_MODE


# Now if the recipient exemption mode is not the same as the message
# exemption mode (so recipients want the message handled differently)
# defer the message for the current recipient

defer  condition   = ${if eq{$ACL_MSG_EXEMPTION_MODE}{$ACL_RCPT_EXEMPTION_MODE} {no}{yes}}
       message     = 450 Deferred - please re-try for this recipient
       log_message = Deferred for $local_part@$domain due to user preference conflict


...

and do your normal message checks, accept/deny/defer as appropriate.

Hope this helps

Regards

Richard