Thank you for your help. It works, but only for e-mail addressed to an actual username - i.e., not an alias.

For e-mails addressed to an alias@domain, Postfix doesn't translate the alias to username before asking Dovecot, which then replies with "user unknown" and mail is rejected.

For example, an e-mail sent to a user over quota and his alias:

   ----- The following addresses had permanent fatal errors -----
<alias@domain>
    (reason: 554 5.7.1 <alias@domain>: Recipient address rejected: Unknown user)
<username@domain>
    (reason: 554 5.2.2 <username@domain>: Recipient address rejected: Quota exceeded (mailbox for user is full))


Anyway, this is what I added to Dovecot's configuration:

service quota-status {
  executable = quota-status -p postfix
  inet_listener {
    port = 999
  }
  client_limit = 1
}

And this to Postfix's configuration:

smtpd_recipient_restrictions = check_policy_service inet:localhost:999


Is there any timeline for fixing the bug in the current sieve behaviour regarding duplicates?




On 21. 04. 21 03:16, Benny Pedersen wrote:
On 2021-04-20 20:41, Aleš Pečnik wrote:
I'm using Dovecot with Postfix (via LMTP). Because Postfix doesn't
de-duplicate recipients, I'm using sieve to drop duplicates, following
this recipe:
https://serverfault.com/questions/112958/postfix-aliases-and-duplicate-e-mails-how-to-fix

its a bug, but the workaround is to

https://doc.dovecot.org/configuration_manual/quota_plugin/

so postfix tempfail before lmtp delivery the first time

hopefully it credited you report this problem