home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- #
- # This hack runs sendmail in SMTP mode and uses the EXPN command to
- # expand an address into the real address(es) that the mail will be
- # delivered to. It takes advantage of sendmail's ability to read
- # SMTP commands from standard input when you use the -bs flag.
- #
- # Usage:
- # expn alias
- #
- # Output:
- # the address(es) mail sent to ``alias'' will really go to
-
- if [ -z "$1" ]; then
- echo usage: `basename $0` sendmail-alias
- exit 1
- fi
- echo "expn $1
- quit" | /usr/lib/sendmail -bs | tr -d '\015' | \
- sed -e 's/^250.*<\([^>]*\)>.*/\1/' \
- -e 's/^5[0-9][0-9].\(.*\)/\1/' \
- -e '/^[0-9][0-9][0-9] /d' | sort
- exit 0
-
-