当超出配额时,Dovecot 不会拒绝传入的电子邮件

当超出配额时,Dovecot 不会拒绝传入的电子邮件

我在 CentOS 7 下拥有带有 Exim+Dovecot 邮件系统的 VPS。

cat /etc/dovecot/conf.d/10-mail.conf
mail_privileged_group = mail
mail_access_groups = mail
mail_location = maildir:%h/mail/%d/%n
pop3_uidl_format = %08Xu%08Xv
mail_plugins = $mail_plugins quota 

cat /etc/dovecot/conf.d/20-imap.conf
##
## IMAP specific settings
##

protocol imap {
mail_plugins = $mail_plugins autocreate imap_quota    
}

plugin {
  autocreate = Trash
  autocreate2 = Spam
  autocreate3 = Sent
  autocreate4 = Drafts
  #autocreate5 = Custom
  autosubscribe = Trash
  autosubscribe2 = Spam
  autosubscribe3 = Sent
  autosubscribe4 = Drafts
  #autosubscribe5 = Custom
}

cat /etc/dovecot/conf.d/90-quota.conf
plugin {
  quota = dict:User quota::file:%h/dovecot-quota
    quota_rule = *:storage=10M:messages=1000
    }

doveadm命令返回:

doveadm quota get -u [email protected]
Quota name Type    Value Limit    %
User quota STORAGE 11620 10240   113
User quota MESSAGE     4  1000   0

如何配置 Dovecot 以便当邮箱 100% 已满时不允许发送电子邮件?

答案1

您需要使用限制 Exim 邮件容量,或者要求 Exim 使用 Dovecot 分发电子邮件。对于您而言,仅当用户尝试通过拖放将邮件从其 PC 上传到 IMAP 服务器时才会应用配额。

看着http://wiki.dovecot.org/LDA/Exim

答案2

quota您不仅要为imap协议声明插件,还要为lda协议声明插件,因为在 LDA 阶段配额是根据当前 maildir 大小进行测试的。

protocol imap {
  mail_plugins = autocreate quota imap_quota    
  . . . . .
}

protocol lda {
  mail_plugins = quota 
  . . . . .
}

相关内容