System Administrator Documentation

This guide explains how to manage user quotas and view server statistics using maddy commands.

💡 Tip: All these operations can also be performed through the Web Admin Interface at /admin/ — no command line required.

Quota Management

You can manage user storage quotas using the maddy imap-acct quota subcommands.

View User Quota

Display the used space and maximum allowance for a specific user.

maddy imap-acct quota get username@example.com

Set User Quota

Set a custom storage limit for a user (e.g., 1GB, 500MB, or 10KB).

maddy imap-acct quota set username@example.com 1GB

Reset User Quota

Remove the user's custom quota and revert to the system default. The user's account creation date is preserved.

maddy imap-acct quota reset username@example.com

Set System-Wide Default Quota

Set the default storage limit for all users without a custom quota. This value is stored in the database and takes priority over the maddy.conf setting.

maddy imap-acct quota set-default 2GB

List All Quotas

Display all users with their used space and quota limits. The list shows whether each user's quota is custom or inherited from the system default.

maddy imap-acct quota list

Maintenance & Cleanup

Commands for managing server load and freeing space by removing user data.

Purge Send Queue

Remove all pending messages in the send queue related to a specific user (sender or recipient). Useful for clearing queue jams caused by spam or large messages.

maddy queue purge username@example.com

Purge IMAP Messages for a User

Delete all emails for a user from all mailboxes (Inbox, Sent, etc.) without deleting the account or quota settings. Useful for quickly freeing disk space.

maddy imap-acct purge-msgs username@example.com

Purge All Messages for All Users

Delete all emails across the entire server for all users. This clears all email data while keeping user accounts, passwords, and quotas intact.

maddy imap-acct purge-all

Purge All Read Messages

Delete all emails marked as read (Seen) across the entire server. New unread messages are preserved. Helps optimize space without losing new messages.

maddy imap-acct purge-read [--yes]

Prune Old Unread Messages

Delete unread messages older than the specified duration (e.g., 30 days). Useful for cleaning up old emails that users never opened.

maddy imap-acct prune-unread 720h [--yes]

Registration Management

You can open or close new user registration. When closed, only users with existing accounts can log in.

Open Registration

maddy creds registration open

Close Registration

maddy creds registration close

View Current Status

maddy creds registration status

Just-In-Time (JIT) Registration

JIT registration allows the server to automatically create user accounts on the first login attempt. You can manage this feature independently of the overall registration setting.

Enable JIT Registration

When enabled, accounts are automatically created on the first login or when the first email is received.

maddy creds jit enable

Disable JIT Registration

When disabled, accounts can only be created via the API (web interface) and login with unregistered credentials is rejected.

maddy creds jit disable

View JIT Status

maddy creds jit status

Call Server Management (TURN/STUN)

You can enable or disable the call server (TURN) for all users. When disabled, call information is not shown on the info page.

Enable Call Server

maddy creds turn on

Disable Call Server

maddy creds turn off

View Current Status

maddy creds turn status

Log Management (No-Log Policy)

You can enable or disable server logging. When disabled, no information about user activity is recorded.

Disable Logging

For user privacy and to prevent storing activity information.

maddy creds log disable

Enable Logging

maddy creds log enable

View Current Status

maddy creds log status

Website Language

You can change the language of the web interface. Supported languages: English (en), Farsi (fa), Russian (ru), Spanish (es). Changes take effect immediately without a restart.

View Current Language

maddy language

Set Language

Switch the website to a different language.

maddy language set fa

Reset to Default

Remove the database override and revert to the language configured in maddy.conf.

maddy language reset

Port & Configuration Settings

Ports and service settings (such as hostname, secret, relay IP, etc.) can be managed through the Admin API. These settings are stored in the database and take priority over the configuration file values.

Manageable Settings

To manage these settings, use the Admin API. The relevant endpoints are documented in the "Port Settings" and "Configuration Settings" sections of the API docs.

Stealth Mode

Madmail server can operate in stealth mode for enhanced security. In this mode, only essential ports remain open to the outside world.

Essential ports:

Other ports (such as 25, 143, 587, 993) can be closed via firewall for public access. Users connect to all services through the Shadowsocks proxy configured in the app, keeping your server hidden from internet scanners.

Disabling Admin API

The Admin API is enabled by default. To completely disable it via the configuration file for enhanced security, set the following option in maddy.conf under the chatmail section.

maddy.conf Setting

Set admin_token to disabled:

chatmail tls://0.0.0.0:443 { # ... other settings ... # Disable the admin API entirely: admin_token disabled }

After saving the file, restart the maddy service. This will disable all web admin panel and Admin API functionality.

DNS Cache & Address Rewriting

The internal DNS cache system allows you to redirect outgoing email routing to custom servers without changing the OS DNS settings. Rewrite rules are stored in the main program database (the storage database). Changes take effect immediately without server restart.

View All Rewrites

Display all DNS rewrite rules stored in the database.

maddy dns-cache list

Create or Edit Rewrite

Set a DNS rewrite rule. If a rule already exists for this address, it will be updated.

maddy dns-cache set LOOKUP_KEY TARGET_HOST [COMMENT]

Examples:

# Route domain emails to internal server maddy dns-cache set nine.testrun.org 10.0.0.5 "Route to staging" # Rewrite IP address maddy dns-cache set 1.1.1.1 2.2.2.2 "Redirect IP" # Route to new server during migration maddy dns-cache set example.com new-mx.example.com "Migration"

View Specific Rewrite

Display details of a DNS rewrite rule including source address, target, comments, and creation time.

maddy dns-cache get nine.testrun.org

Delete Rewrite

Remove a DNS rewrite rule. After removal, emails will be routed through normal OS DNS.

maddy dns-cache remove nine.testrun.org

How It Works

Server Statistics

View Overall Statistics

Display total storage used on the server and the number of active user accounts.

maddy imap-acct stat

Online Connection Monitoring

The maddy status command shows the real-time server status. This includes active IMAP connections, TURN relays (voice/video calls), Shadowsocks, registered users, and uptime.

View Active Connections

Display server status summary including active connections, registered users, boot time, and uptime.

maddy status

Sample output:

IMAP            connections: 27     unique IPs: 7
TURN            relays: 1
Shadowsocks     connections: 0      unique IPs: 0

Registered users:   42
Boot time:          2026-02-16 20:56:19 (up 5m 24s)

Email servers seen (since last restart):
  Connection IPs:   1
  Domain servers:   1
  IP servers:       0

View Details by Port

Use the --details (or -d) flag to see connection details broken down by port.

maddy status --details

Sample output:

PORT   PROTO   TYPE              CONNECTIONS   UNIQUE IPs
993    tcp     IMAP TLS          25            7
143    tcp     IMAP              0             0
3478   udp     TURN UDP          1 relays      -
3478   tcp     TURN TCP          0             0
8388   tcp     Shadowsocks       0             0
443    tcp     ALPN (chatmail)   3             1

Field Descriptions