Evgeniy Berdnikov via Exim-users wrote:
> 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:
Yes, trivial and perfect! Thank you.
>
> # cond1
> accept condition = ${if or{ ... }}
>
> deny message = Unknown user (no such mailbox)
> domains = +dovecot_domains
Sometimes it's trivial things that we do not see. It did not occur to me
that there was no need to look up the domains in /etc/dovecot/users
again since I had the +dovecot_domains list already.
OTOH it would be good to have the +dovecot_domains compiled automatically
from all the domains in /etc/dovecot/users instead of defining it as a
semi-static list.
(I call it semi-static because it's defined as
"domainlist dovecot_domains = dsearch;/home/vmail"
So when I add a new dovecot domain, I must remember to create the directory
under /home/vmail or rely on dovecot to create it).
>
> # cond2
> require message = relay not permitted
> domains = +local_domains : +relay_to_domains
--
Victor Sudakov, VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet
http://vas.tomsk.ru/