notes-techniques/notes/scripts/server-mail/add_alias.sh

19 lines
307 B
Bash
Executable File

#!/bin/bash
POSTFIX_ALIASES="/etc/postfix/virtual_aliases"
if [[ -z "$1" || -z "$2" ]]; then
echo "Usage: $0 <alias> <cible>"
exit 1
fi
ALIAS=$1
TARGET=$2
echo "$ALIAS $TARGET" >> $POSTFIX_ALIASES
postmap $POSTFIX_ALIASES
systemctl reload postfix
echo "Alias $ALIAS ajouté vers $TARGET 🎉"