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

NAME

Mail::ExpandAliases - Expand aliases from /etc/aliases files

SYNOPSIS

    use Mail::ExpandAliases;

    my $ma = Mail::ExpandAliases->new("/etc/aliases");
    my @list = $ma->expand("listname");

DESCRIPTION

I've looked for software to expand aliases from an alias file for a while, but have never found anything adequate. In this day and age, few public SMTP servers support EXPN, which makes alias expansion problematic. This module, and the accompanying expand-alias script, attempts to address that deficiency.

USAGE

Mail::ExpandAliases is an object oriented module, with a constructor named new:

    my $ma = Mail::ExpandAliases->new("/etc/mail/aliases");

new takes the filename of an aliases file; if not supplied, or if the file specified does not exist or is not readable, Mail::ExpandAliases will look for /etc/aliases and /etc/mail/aliases, and use the first one found.

Lookups are made using the expand method:

    @aliases = $ma->expand("listname");

expand returns a list of expanded addresses. These expanded addresses are also expanded, whenever possible.

A non-expandible alias (no entry in the aliases file) expands to itself, i.e., does not expand.

In scalar context, expand returns a reference to a list.

Note that Mail::ExpandAliases provides read-only access to the alias file. If you are looking for read access, see Mail::Alias, which is a more general interface to alias files.

BUGS / SHORTCOMINGS

If you were telnet mailhost 25, and the server had EXPN turned on, the sendmail would read a user's .forward file. This software cannot do that, and makes no attempt to. Only the invoking user's .forward file should be readable (if any other user's .forward file was readable, sendmail would not read it, making this feature useless), and the invoking user should not need this module to read their own .forward file.

Any other shortcomings, bugs, errors, or generally related complaints and requests should be reported via the appropriate queue at <http://rt.cpan.org/>.

VERSION

$Id: ExpandAliases.pm,v 1.2 2002/09/24 11:01:16 dlc Exp $

AUTHOR

darren chamberlain <darren@cpan.org>