A simple REST API server exposing of Docker mailserver, able to run with low amounts of ram. Project repository:


I wanted to be able to programmatically access, via an API. Because I want to make a small UI around it, together with some of my other services that I host. And since I thought I wouldn’t be the only person that could use something like this, hence this little project.


  • CRUD operations for email accounts
  • Create, list (via email listing), delete and operations for email aliasses
  • CRUD operations for fail2ban
  • Using is by default available on the Docker image, and allows for management of the server via the CLI, it provides the following features:


    setup - 'docker-mailserver' Administration & Configuration CLI

    setup [ OPTIONS... ] COMMAND [ help | ARGUMENTS... ]

    COMMAND := { email | alias | quota | dovecot-master | config | relay | debug } SUBCOMMAND

    This is the main administration command that you use for all your interactions with
    'docker-mailserver'. Initial setup, configuration, and much more is done with this CLI tool.

    Most subcommands can provide additional information and examples by appending 'help'.
    For example: 'setup email add help'

    COMMAND email :=
        setup email add <EMAIL ADDRESS> [<PASSWORD>]
        setup email update <EMAIL ADDRESS> [<PASSWORD>]
        setup email del [ OPTIONS... ] <EMAIL ADDRESS> [ <EMAIL ADDRESS>... ]
        setup email restrict <add|del|list> <send|receive> [<EMAIL ADDRESS>]
        setup email list

    COMMAND alias :=
        setup alias add <EMAIL ADDRESS> <RECIPIENT>
        setup alias del <EMAIL ADDRESS> <RECIPIENT>
        setup alias list

    COMMAND quota :=
        setup quota set <EMAIL ADDRESS> [<QUOTA>]
        setup quota del <EMAIL ADDRESS>

    COMMAND dovecot-master :=
        setup dovecot-master add <USERNAME> [<PASSWORD>]
        setup dovecot-master update <USERNAME> [<PASSWORD>]
        setup dovecot-master del [ OPTIONS... ] <USERNAME> [ <USERNAME>... ]
        setup dovecot-master list

    COMMAND config :=
        setup config dkim [ ARGUMENTS... ]

    COMMAND relay :=
        setup relay add-auth <DOMAIN> <USERNAME> [<PASSWORD>]
        setup relay add-domain <DOMAIN> <HOST> [<PORT>]
        setup relay exclude-domain <DOMAIN>

    COMMAND fail2ban :=
        setup fail2ban 
        setup fail2ban ban <IP>
        setup fail2ban unban <IP>
        setup fail2ban log
        setup fail2ban status

    COMMAND debug :=
        setup debug fetchmail
        setup debug login <COMMANDS>
        setup debug show-mail-logs

    setup email add
        Add the email account You will be prompted
        to input a password afterwards since no password was supplied.

    setup config dkim keysize 2048 domain ','
        Creates keys of length 2048 for the domains in comma-seperated list.
        This is necessary when using LDAP as the required domains cannot be inferred.

    setup config dkim help
        This will provide you with a detailed explanation on how to use the 
        config dkim command, showing what arguments can be passed and what they do.