当我删除消息时执行 Dovecot quote-warning.sh

当我删除消息时执行 Dovecot quote-warning.sh
plugin {
  quota_rule = *:storage=10M
  quota          = maildir:User quota
  quota_rule2     = Junk:ignore
  quota_rule3    = Trash:storage=+100M
  quota_warning = storage=50%% quota-warning 50 %u
  quota_exceeded = storage=100%% quota-exceeded 100 %u
}

plugin {
  quota_warning = storage=50%% quota-warning 50 %u
  quota_exceeded = storage=100%% quota-exceeded 100 %u
}

service quota-warning {
  executable = script /root/bin/quota-warning.sh
  user = root
  unix_listener quota-warning {
    user = vmail
    mode = 0666
  }
}

service quota-exceeded {
  executable = script /root/bin/quota-exceeded.sh
  user = root
  unix_listener quota-exceeded {
    user = vmail
    mode = 0666
  }
}

我发送了一封 8Mb 的电子邮件(限制为 10Mb),但是当我删除该消息(将其移至垃圾箱)时执行了配额警告,而不是执行超出配额。

cat /root/bin/quota-warning.sh
touch /tmp/quota-warning-executed
cat /root/bin/quota-exceeded.sh
touch /tmp/quota-exceeded-executed

答案1

您必须为Junk文件夹和开销配置配额排除Trash

plugin {
  quota          = maildir:User quota
  quota_rule     = Junk:ignore
  quota_rule2    = Trash:storage=+100M
  quota_warning  = storage=50%% quota-warning 50 %u
  quota_exceeded = storage=100%% quota-exceeded 100 %u
}

根据dovecotwiki 的说明,为了避免迁移到 时出现配额警告Trash

您可以创建单独的配额规则,为垃圾邮箱提供略高的配额限制(但不是无限制的)

这是有意为之,因为移动到是Trash两步过程(复制 + 删除)。在短时间内,您拥有同一条消息的两个副本,并且它们都由配额插件计算。如果Trash有一些开销,那么新复制的消息不会超过主要限制。有关更多信息,请参阅 dovecot 的 wiki:https://wiki.dovecot.org/Quota

相关内容