docker-mailserver/target/bin/addalias
Joerg Sonnenberger 097dc6c9a4
docs(bin/setup): Add an example for an alias with multiple recipients (#3600)
Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>
2023-10-26 13:22:36 +13:00

47 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 2 "${@}"
local MAIL_ALIAS="${1}"
local RECIPIENT="${2}"
_manage_virtual_aliases_update "${MAIL_ALIAS}" "${RECIPIENT}" \
|| _exit_with_error "'${MAIL_ALIAS}' is already an alias for recipient: '${RECIPIENT}'"
}
function __usage() {
printf '%s' "${PURPLE}addalias${RED}(${YELLOW}8${RED})
${ORANGE}USAGE${RESET}
./setup.sh alias add <MAIL ALIAS> <RECIPIENT>
${ORANGE}OPTIONS${RESET}
${BLUE}Generic Program Information${RESET}
help Print the usage information.
${ORANGE}DESCRIPTION${RESET}
Add an alias for a recipient (a mail account).
Alias and recipient domains can be different.
The recipient domain can be external (eg: @gmail.com).
${ORANGE}EXAMPLES${RESET}
${LWHITE}./setup.sh alias add alias@example.com recipient@example.com${RESET}
Add the alias 'alias@example.com' for the mail account 'recipient@example.com'.
${LWHITE}./setup.sh alias add alias@example.com 'recipient@example.com, another-recipient@example.com'${RESET}
Multiple recipients are separated by comma.
${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 "${@}"