On Wed, Nov 04, 2020 at 12:32:06PM +0700, Victor Sudakov via Exim-users wrote:
> Thanks to the collective help, I have the following conditions in
> acl_smtp_rcpt:
>
> ===============================
> # cond1
>
> accept condition = ${if or{ \
> {bool{${lookup{$local_part@$domain}lsearch{/etc/dovecot/aliases}{yes}{no}}}} \
> {bool{${lookup{$local_part@$domain}lsearch{/etc/dovecot/users}{yes}{no}}}} \
> }}
>
> # cond2
>
> require message = relay not permitted
> domains = +local_domains : +relay_to_domains
> ===============================
>
>
> Now if the recipient's full address is not in /etc/dovecot/users, but the
> recipient's domain *is* in +dovecot_domains, the mail is rejected with the
> "relay not permitted" message.
>
> Technically this is correct. But I would like to have a special error
> message for this situation, like "Unknown user" (i.e. the domain is ours
> all right, but there is no such mailbox).
Either I don't understand you or it's completely trivial:
# cond1
accept condition = ${if or{ ... }}
deny message = Unknown user (no such mailbox)
domains = +dovecot_domains
# cond2
require message = relay not permitted
domains = +local_domains : +relay_to_domains
--
Eugene Berdnikov