#!/usr/bin/perl

use warnings;
use strict;
use Net::LDAP;

my $ldap;
my $ldapserver = "localhost";
my $basedn = "ou=people,dc=acme,dc=com";
my $result;

$ldap = Net::LDAP->new($ldapserver) or die "$@";
$ldap->bind ();

$result = $ldap->search(
    base    =>  "$basedn",
    filter  => "(objectClass=sendmailMTAAlias)"
    );

print "\n";
foreach my $entry ($result->entries) {
    print $entry->get_value("sendmailMTAKey") .
       " -> " .
       $entry->get_value("sendmailMTAAliasValue") .
       "\n\n";
}



