#
# redirect: generate rules to reject mails with redirect error message
#

REVISION_ID='@(#)redirect	3.11 (motonori/WIDE) 17 Sep 1996'

#|# use REDIRECT error message feature (yes/no)
#|#REDIRECT=no

: ${REDIRECT=no}
if [ "$REDIRECT" != no ]
then

	if [ "$REVISION_ID_LIST" ]
	then
		REVISION_ID_LIST="$REVISION_ID_LIST\\
# $REVISION_ID"
	else
		REVISION_ID_LIST="# $REVISION_ID"
	fi

	FAKE_DOMAIN_NAME="REDIRECT FORWARD UNKNOWN"

	if [ "$FAKEDOMAIN" ]
	then

FAKEDOMAIN="$FAKEDOMAIN\\
C$_FD_CHAR $FAKE_DOMAIN_NAME"

	else

FAKEDOMAIN="C$_FD_CHAR $FAKE_DOMAIN_NAME"

	fi

	case "$CF_FORMAT" in
	V1|NMTC)

REDIRECTRULE='\
# addresses which gives a 551 error code w/ message\
R$*<@USER.UNKNOWN>	$#error$@NOUSER$: "551 User has moved and new address is not known, sorry."\
# addresses sent to foo@host.REDIRECT will give a 551 error code w/ message\
R$*<@$+.REDIRECT>	$#error$@NOUSER$: "551 User has moved; please try " <$1@$2>\
# addresses sent to foo@host.FORWARD will give a 551 error code w/ message\
R$*<@$+.FORWARD>	$#error$@NOUSER$: "551 User has moved; your mail has been forwarded; next time please try to " <$1@$2>'
		;;

	V5)

REDIRECTRULE='\
# addresses which gives a 551 error code w/ message\
R$*<@USER.UNKNOWN>	$#error$@NOUSER$: "551 User has moved and new address is not known, sorry."\
# addresses sent to foo@host.REDIRECT will give a 551 error code w/ message\
R$*<@$+.REDIRECT>	$#error$@NOUSER$: "551 User has moved; please try " <$1@$2>\
# addresses sent to foo@host.FORWARD will give a 551 error code w/ message\
R$*<@$+.FORWARD>	$#error$@NOUSER$: "551 User has moved; your mail has been forwarded; next time please try to " <$1@$2>'
		;;

	*)

REDIRECTRULE='\
# addresses which gives an error w/ message\
R$*<@USER.UNKNOWN>	$#error$@5.1.6$: User has moved and new address is not known, sorry.\
# addresses sent to foo@host.REDIRECT will give an error w/ message\
R$*<@$+.REDIRECT>	$#error$@5.1.6$: User has moved; please try <$1@$2>\
# addresses sent to foo@host.FORWARD will give an error w/ message\
R$*<@$+.FORWARD>	$#error$@5.1.6$: User has moved; your mail has been forwarded; next time please try to <$1@$2>'
		;;

	esac

fi
