Skip to content

Mail: public folders reject messages when they exceed the default mailbox quota #8305

Open

Description

@lucagasparini

Steps to reproduce

  • In the Mail application settings, set a default mailbox quota, for example 3 GB
  • Create one or more public folders and send messages to them until their combined size is bigger than the default quota
  • Send another message to a public folder address

Expected behavior

Public folders have no size limit. The default mailbox quota applies only to user mailboxes, and users keep their configured quotas.

Actual behavior

The message is rejected with:

552 5.2.2 Quota exceeded (mailbox for user is full)

All public folders are stored in the mailbox of an internal technical user, vmail. Dovecot (the IMAP server) applies the default mailbox quota to every user, so vmail gets it too. All public folders together share that one limit. The vmail user is not listed on the Mailboxes page, so its quota can't be changed from the user interface.

Workaround

See the comment below.

Components

Mail 1.9.3 and earlier. The problem is still present in Mail 2.0.0-beta.1 (Dovecot 2.4).

See also

Activity

  1. added this to the NethServer 8.11 milestone on Nov 11, 2026
  2. changed the title [-]Mail: fix default quota enforcement on the vmail user for public folders[/-] [+]Mail: public folders reject messages when they exceed the default mailbox quota[/+] on Nov 11, 2026
  3. moved this from ToDo to In Progress in NethServeron Nov 11, 2026
  4. DavidePrincipi commented on Nov 11, 2026

    @DavidePrincipi
    Member

    Persistent workaround

    The workaround in the description is lost every time the Mail application settings are saved from the user interface, because Dovecot is reloaded and /etc/dovecot/users is rebuilt. The following workaround survives both reloads and restarts: every time the Dovecot container starts, it patches the script that rebuilds the file (reload-config), so every later reload writes the vmail quota rule too.

    It applies to Mail 1.x (Dovecot 2.3). Replace mail1 with the Mail module ID.

    runagent -m mail1
    mkdir -p scripts
    cat > ./scripts/vmail-quota.sh <<'EOF'
    #!/bin/sh
    # Workaround for NethServer/dev#8305: no quota for vmail (public folders).
    set -eu
    
    # 1. Patch reload-config, so every reload writes the vmail quota rule
    podman exec -u root dovecot sed -i \
        's|^\(echo "vmail:{plain}${DOVECOT_VMAIL_PASS}::::::\)" > /etc/dovecot/users$|\1userdb_quota_rule=*:storage=0M" > /etc/dovecot/users|' \
        /usr/local/bin/reload-config
    
    # 2. Fix the users file already written when the container started
    podman exec -u root dovecot sed -i \
        '/^vmail:/ s|::::::$|::::::userdb_quota_rule=*:storage=0M|' \
        /etc/dovecot/users
    EOF
    chmod 700 ./scripts/vmail-quota.sh
    systemctl --user edit dovecot.service

    In the editor, add at the top of the drop-in file:

    [Service]
    ExecStartPost=-/bin/sh %E/state/scripts/vmail-quota.sh

    Then apply it:

    systemctl --user daemon-reload
    systemctl --user restart dovecot

    Notes:

    • The drop-in ExecStartPost runs after the unit's own ExecStartPost commands, which wait for Dovecot to be up, so the users file already exists.
    • The script can run any number of times: both sed commands match only the unpatched text.
    • The leading - means that if the script fails, Dovecot starts anyway without the workaround.

    Check that the quota rule is still there after a reload:

    systemctl --user reload dovecot
    podman exec dovecot doveadm quota get -u vmail

    The STORAGE limit of vmail must be - (unlimited).

    Tested with the mail-dovecot:1.9.3 image (Dovecot 2.3.21.1) and a 10 MB default quota: before the workaround vmail had a 10240 KB limit. After the script, and after each reload-config run (the same command run when settings are saved), vmail had no limit. The systemd drop-in itself was not exercised on a real Mail 1.9.x module.

    Remove the workaround before upgrading to the Mail release that fixes this issue, which uses Dovecot 2.4, where the userdb_quota_rule syntax is no longer valid:

    runagent -m mail1
    systemctl --user revert dovecot
    rm -f scripts/vmail-quota.sh
    systemctl --user restart dovecot
  5. added a commit that references this issue on Nov 11, 2026
  6. DavidePrincipi commented on Nov 11, 2026

    @DavidePrincipi
    Member

    The testing image ghcr.io/nethserver/mail:2.0.0-beta.2 is available, with the fix from NethServer/ns8-mail#342.

    The internal vmail user, which holds the public folders, is now exempted from the default mailbox quota: its quota is unlimited by default. Administrators can limit the total size of public folders with the DOVECOT_VMAIL_QUOTA_MB environment variable (value in MB, 0 = unlimited), as described in the module README.

    Test cases for verification:

    • Set a default mailbox quota, for example 50 MB, from the Mail settings. A user without a custom quota gets that limit, while podman exec dovecot doveadm quota get -u vmail shows no STORAGE limit (-).
    • Send messages to public folders until their combined size is bigger than the default quota: they are still delivered, with no "Quota exceeded" error.
    • Set DOVECOT_VMAIL_QUOTA_MB to 60 and reload Dovecot: the vmail STORAGE limit becomes 61440 KB, and user quotas do not change.
    • Remove the variable and set the default quota back to unlimited: both vmail and users have no limit.
    • Update an existing installation where the problem happens: public folders accept messages again after the update, with no manual steps.

    Automated coverage: tests/40__api/60__dovecot.robot (The vmail user is exempted from the default quota, The vmail user quota is overridden by the environment, Restore the vmail and default quota).

  7. added
    testing
    on Nov 11, 2026
  8. moved this from In Progress to Testing in NethServeron Nov 11, 2026
  9. DavidePrincipi commented on Nov 27, 2026

    @DavidePrincipi
    Member

    VERIFIED

    Tested on Rocky Linux 9.8, core 3.25.1. The other test cases are covered by the automated tests: this checks the update of an existing installation where the problem happens.

    1. Mail 1.9.3 with a 1 MB default mailbox quota and a public mailbox qapub with the address qapub@example.org. After about 800 KB of messages, doveadm quota get -u vmail shows a 1024 KB limit, and the next message is bounced with 552 5.2.2 ... Quota exceeded (mailbox for user is full). Problem reproduced.
    2. Update to 2.0.0-beta.6, with no manual steps: vmail has no STORAGE limit (-), and three more 400 KB messages to qapub@example.org are delivered (2035 KB total). The user qa2 keeps the 1024 KB default limit.
  10. added
    verified
    and removed
    testing
    on Nov 27, 2026
  11. moved this from Testing to In Progress in NethServeron Nov 27, 2026
  12. moved this from In Progress to Verified in NethServeron Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

verified

Type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions