mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
46 lines
1.2 KiB
Bash
Executable file
46 lines
1.2 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
# shellcheck source=../scripts/helpers/index.sh
|
|
source /usr/local/bin/helpers/index.sh
|
|
|
|
function _main
|
|
{
|
|
[[ ${1:-} == 'help' ]] && { __usage ; exit 0 ; }
|
|
|
|
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 "${@}"
|