1
1
mirror of https://github.com/docker-mailserver/docker-mailserver synced 2024-12-18 14:04:17 +01:00
docker-mailserver/target/bin/addmailuser
Casper d7dab2d20d
feat: Add password confirmation (#4072)
Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
2024-06-19 06:10:00 +00:00

49 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
# shellcheck source=../scripts/helpers/index.sh
source /usr/local/bin/helpers/index.sh
function _main() {
_require_n_parameters_or_print_usage 1 "${@}"
local MAIL_ACCOUNT="${1}"
local PASSWD="${2}"
_manage_accounts_create "${MAIL_ACCOUNT}" "${PASSWD}"
# NOTE: An account has only been added to `postfix-accounts.cf`.
# The `changedetector` service will be triggered from this update
# where the actual account is created in Dovecot. Expect a delay.
}
function __usage() {
printf '%s' "${PURPLE}addmailuser${RED}(${YELLOW}8${RED})
${ORANGE}USAGE${RESET}
./setup.sh email add <MAIL ACCOUNT> [<PASSWORD>]
${ORANGE}OPTIONS${RESET}
${BLUE}Generic Program Information${RESET}
help Print the usage information.
${ORANGE}DESCRIPTION${RESET}
Add a new mail account (email address).
To avoid a password being logged in the command history of your shell,
you may omit it, you'll be prompted to input the password instead.
${ORANGE}EXAMPLES${RESET}
${LWHITE}./setup.sh email add user@example.com${RESET}
Create the email account 'user@example.com'.
You will be prompted to input a password afterwards since no password was supplied.
${ORANGE}EXIT STATUS${RESET}
Exit status is 0 if command was successful. If wrong arguments are provided
or arguments contain errors, the script will exit early with exit status 1.
"
}
_main "${@}"