1
1
Fork 0
mirror of https://github.com/docker-mailserver/docker-mailserver synced 2024-05-12 08:06:05 +02:00
docker-mailserver/target/bin/addalias
2023-05-26 01:01:41 +02:00

44 lines
1.2 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'.
${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 "${@}"