The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

expand-alias - expand mail aliases from /etc/aliases

SYNOPSIS

    $ expand-alias MAILER-DAEMON
    root

    $ expand-alias -c listname
    addr1, addr2, addr3

    $ expand-alias -n listname
    addr1
    addr2
    addr3

    $ expand-alias -t listname
    addr1       addr2   addr3

    $ expand-alias -f ~/my.aliases friends
    friend1@isp.net other.friend@isp2.net

    $ expand-alias -f ~/my.aliases -s friends
    friend1@isp.net and other.friend@isp2.net

DESCRIPTION

expand-alias expands aliases from an aliases file, as implemented by the Mail::ExpandAliases module.

USE

expand-alias takes 0 or more aliases as arguments:

    $ expand-alias postmaster
    darren@cpan.org

    $ expand-alias foo
    foo

Note that unknown aliases expand to themselves; that is, they don't expand.

expand-alias has several command line swicthes that control the output:

-c

comma-separated output:

    $ expand-alias -c listname
    addr1, addr2, addr3
-t

tab-separated output

    $ expand-alias -c listname
    addr1       addr2   addr3
-n

newline separated output

    $ expand-alias -n listname
    addr1
    addr2
    addr3
-s

"sentence" form (a, b, and c).

    $ expand-alias -s listname
    addr1, addr2, and addr3

The default separator is a single space:

    $ expand-alias listname
    addr1 addr2 addr3

This is useful in shell scripts:

    $ for addr in `expand-alias -f ~/my.lists friends`; do
    > mail -s 'For your eyes only!' $addr < secret-file
    > done

expand-alias also takes a -f option, as hinted above, which indicates the file to be used; by default this is either /etc/aliases or /etc/mail/aliases, tried in order until one is found.

If the -v (verbose) flag is set, alias expansions are prefixed by the alias itself. This is useful when specifying multiple aliases on the command line:

    $ expand-alias -vc listone listtwo listthree
    listone: addr1, addr2, addr3
    listtwo: addr4, addr3, addr2
    listthree: addr1, addr4, addr3

NOTES

expand-alias works by reading the /etc/aliases file; it does not attempt a EXPN against an SMTP server, and, for security reasons, it does not try to read a user's .forward file.

AUTHOR

darren chamberlain <darren@cpan.org>

SEE ALSO

Perl, Mail::ExpandAliases