gnu-social/docker/mail/rootfs/usr/bin/new-alias.sh

23 lines
367 B
Bash
Raw Normal View History

#!/bin/sh
USAGE="Usage: $0 ALIAS TARGET";
if [ -z "$2" ]
then
echo "$USAGE";
exit 1;
fi
DOMAINPART=$(echo $1 | sed -e "s/^.*\@//")
2020-11-01 02:19:13 +09:00
if ! grep -q "^$DOMAINPART" /etc/mail/domains
then
echo "This server is not responsible for the domain of this alias."
exit 1
fi
2020-11-01 02:19:13 +09:00
echo "$1 $2" >> /etc/mail/aliases
postmap /etc/mail/aliases
postfix reload
echo "Alias added."