Skip to content

Your Best Friend is an administration script that helps with the most common tasks, including initial configuration. It is intended to be run from the host machine, not from inside your running container.

The latest version of the script is included in the docker-mailserver repository. You may retrieve it at any time by running this command in your console:

chmod a+x ./ for docker-mailserver version v10.1.x and below

If you're using docker-mailserver version v10.1.x or below, you will need to get with a specific version. Substitute <VERSION> with the tagged release version that you're using:



Run ./ help and you'll get all you have ever wanted some usage information:


NAME - docker-mailserver administration script

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

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

    This is the main administration script that you use for all your interactions with
    'docker-mailserver'. Setup, configuration and much more is done with this script.

    Please note that the script executes most of the commands inside the container itself.
    If the image was not found, this script will pull the ':latest' tag of
    'mailserver/docker-mailserver'. This tag refers to the latest release,
    see the tagging convention in the README under

    You will be able to see detailed information about the script you're invoking and
    its arguments by appending help after your command. Currently, this
    does not work with all scripts.

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

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

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

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

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

    COMMAND fail2ban =
        ./ fail2ban
        ./ fail2ban ban <IP>
        ./ fail2ban unban <IP>

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

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

    ./ config dkim keysize 2048 domain ','
        Creates keys of length 2048 but in an LDAP setup where domains are not known to
        Postfix by default, so you need to provide them yourself in a comma-separated list.

    ./ 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.

    Config path, container or image adjustments
        -i IMAGE_NAME
            Provides the name of the 'docker-mailserver' image. The default value is

            Provides the name of the running container.

        -p PATH
            Provides the config folder path to the temporary container
            (does not work if a 'docker-mailserver' container already exists).

            Allows container access to the bind mount content that is shared among
            multiple containers on a SELinux-enabled host.

            Allows container access to the bind mount content that is private and
            unshared with other containers on a SELinux-enabled host.

    Exit status is 0 if the command was successful. If there was an unexpected error, an error
    message is shown describing the error. In case of an error, the script will exit with exit
    status 1.