<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
Hi all:<br>
<br>
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:
<a class="moz-txt-link-freetext"
href="https://serverfault.com/questions/112958/postfix-aliases-and-duplicate-e-mails-how-to-fix">https://serverfault.com/questions/112958/postfix-aliases-and-duplicate-e-mails-how-to-fix</a><br>
<br>
A "sieve_before" script contains:<br>
<br>
require ["duplicate"];<br>
if duplicate<br>
{<br>
discard;<br>
stop;<br>
}<br>
<br>
It works well, except when the recipient is over quota. Dovecot is
configured for tempfail in this case: quota_full_tempfail = yes<br>
<br>
When a mail arrives for a user who's over quota, Postfix logs this:<br>
<br>
AF4481700032: to=<?@?>, relay=?[private/dovecot-lmtp],
delay=0.05, delays=0.05/0/0/0, dsn=4.2.2, status=deferred (host
?[private/dovecot-lmtp] said: 452 4.2.2 <?@?> Quota exceeded
(mailbox for user is full) (in reply to end of DATA command))<br>
<br>
Approximately 10 minutes later, Postfix retries, and log shows:<br>
<br>
dovecot: lmtp(?)<1742912><+EYHBXjidmBAmBoAcAY70w>:
sieve: msgid=<489132c2-7b77-cd2f-ce60-439f6558ddcf@?>: marked
message to be discarded if not explicitly delivered (discard action)<br>
postfix/lmtp[1742691]: AF4481700032: to=<?@?>,
relay=?[private/dovecot-lmtp], delay=431, delays=431/0/0/0,
dsn=2.0.0, status=sent (250 2.0.0 <?@?> +EYHBXjidmBAmBoAcAY70w
Saved)<br>
postfix/qmgr[421343]: AF4481700032: removed<br>
<br>
The message is then nowhere to be found: it's not delivered to
mailbox, bounce isn't sent to the sender, mail is not in postfix
queue. Apparently it's been discarded.<br>
<br>
<br>
I'd say that at first LMTP delivery attempt, sieve records message
as seen, even though it is eventually rejected (452 over quota).
During second attempt sieve "recognizes" the message as seen before
and discards it. (This is just my interpretation of what could be
happening.)<br>
<br>
<br>
Is this a bug or have I misconfigured something? My dovecot -n
output is below.<br>
<br>
<br>
Thanks for help,<br>
<br>
Aleš Pečnik<br>
<br>
<br>
<br>
# dovecot -n<br>
# 2.3.7.2 (3c910f64b): /etc/dovecot/dovecot.conf<br>
# Pigeonhole version 0.5.7.2 ()<br>
# OS: Linux 5.4.0-62-generic x86_64 Ubuntu 20.04.1 LTS <br>
auth_mechanisms = plain login<br>
auth_username_chars =
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890.-_@:<br>
auth_username_format = %Ln<br>
auth_worker_max_count = 3<br>
default_vsz_limit = 1 G<br>
first_valid_gid = 12<br>
first_valid_uid = 8<br>
hostname = something.org<br>
last_valid_gid = 12<br>
last_valid_uid = 8<br>
listen = *<br>
mail_access_groups = mail<br>
mail_location = maildir:/var/dovecot/%u<br>
mail_plugins = " quota mailbox_alias mail_log notify acl"<br>
mail_privileged_group = mail<br>
namespace {<br>
location =
maildir:/var/dovecot/public:INDEXPVT=/var/dovecot/%n/public<br>
prefix = Public.<br>
separator = .<br>
subscriptions = no<br>
type = public<br>
}<br>
namespace inbox {<br>
inbox = yes<br>
location = <br>
mailbox Drafts {<br>
auto = no<br>
special_use = \Drafts<br>
}<br>
mailbox Junk {<br>
special_use = \Junk<br>
}<br>
mailbox Sent {<br>
auto = subscribe<br>
special_use = \Sent<br>
}<br>
mailbox "Sent Messages" {<br>
auto = no<br>
special_use = \Sent<br>
}<br>
mailbox Trash {<br>
auto = no<br>
special_use = \Trash<br>
}<br>
prefix = <br>
}<br>
passdb {<br>
args = /etc/dovecot/dovecot-sql-master.conf.ext<br>
driver = sql<br>
master = yes<br>
pass = yes<br>
}<br>
passdb {<br>
args = /etc/dovecot/dovecot-sql.conf.ext<br>
driver = sql<br>
}<br>
plugin {<br>
acl = vfile<br>
mailbox_alias_new = Sent Messages<br>
mailbox_alias_new2 = Sent Items<br>
mailbox_alias_new3 = Deleted Items<br>
mailbox_alias_new4 = Deleted Messages<br>
mailbox_alias_old = Sent<br>
mailbox_alias_old2 = Sent<br>
mailbox_alias_old3 = Trash<br>
mailbox_alias_old4 = Trash<br>
quota = maildir:User quota<br>
quota_rule = *:storage=200M<br>
quota_rule2 = Trash:storage=+50M<br>
quota_warning = storage=95%% quota-warning 95 %u<br>
quota_warning2 = storage=80%% quota-warning 80 %u<br>
sieve = <a class="moz-txt-link-freetext"
href="file:/var/dovecot/%n/sieve;active=/var/dovecot/%n/sieve/active.sieve">file:/var/dovecot/%n/sieve;active=/var/dovecot/%n/sieve/active.sieve</a><br>
sieve_before = /var/lib/dovecot/sieve.d/<br>
sieve_extensions = +notify +imapflags +editheader +duplicate<br>
}<br>
postmaster_address = <a class="moz-txt-link-abbreviated"
href="mailto:postmaster@something.org">postmaster@something.org</a><br>
protocols = " imap lmtp"<br>
quota_full_tempfail = yes<br>
service auth {<br>
unix_listener /var/spool/postfix/private/auth {<br>
group = postfix<br>
mode = 0660<br>
user = postfix<br>
}<br>
}<br>
service imap-login {<br>
inet_listener imap {<br>
port = 143<br>
}<br>
inet_listener imaps {<br>
port = 0<br>
}<br>
process_min_avail = 12<br>
service_count = 0<br>
}<br>
service imap-postlogin {<br>
executable = script-login /etc/dovecot/postlogin.sh<br>
user = $default_internal_user<br>
}<br>
service imap {<br>
executable = imap imap-postlogin<br>
}<br>
service lmtp {<br>
unix_listener /var/spool/postfix/private/dovecot-lmtp {<br>
group = postfix<br>
mode = 0600<br>
user = postfix<br>
}<br>
}<br>
service pop3-login {<br>
inet_listener pop3 {<br>
port = 0<br>
}<br>
inet_listener pop3s {<br>
port = 0<br>
}<br>
}<br>
ssl_cert = </etc/ssl/my.crt<br>
ssl_client_ca_dir = /etc/ssl/certs<br>
ssl_dh = # hidden, use -P to show it<br>
ssl_key = # hidden, use -P to show it<br>
userdb {<br>
args = /etc/dovecot/dovecot-sql.conf.ext<br>
driver = sql<br>
}<br>
protocol lmtp {<br>
mail_plugins = " quota mailbox_alias mail_log notify acl sieve"<br>
}<br>
protocol lda {<br>
mail_plugins = " quota mailbox_alias mail_log notify acl sieve"<br>
}<br>
protocol imap {<br>
mail_max_userip_connections = 30<br>
mail_plugins = " quota mailbox_alias mail_log notify acl
imap_quota imap_acl"<br>
}<br>
<br>
</body>
</html>