Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello monks, I'm currently working on a little application where I will need to +retrieve mail messages from my InBox in Exchange Server. However, I have not OutLook installed in my computer. My ask is: How may I do it usgin LDAP? Thanks in Advance.

Replies are listed 'Best First'.
Re: Accessing MailBox's from Exchange Server by LDAP
by strat (Canon) on Apr 11, 2002 at 16:53 UTC
    At first, I'm not sure if you can access messages on Exchange with LDAP because I've never tried. I always did so via CDO (=Win32::OLE). All I've already done with Exchange and LDAP is creating distribution lists.

    I prefer using the module-group Net::LDAP (called perl-ldap on CPAN or Activestate).

    You can connect to Exchange like to any other LDAP-Server about in the following way:

    use Net::LDAP; use Net::LDAP::Util qw(ldap_error_text ldap_error_name); # adapt the following variables to your exchange-Server my $server = "192.168.0.1"; # or hostname my $port = 389; my $user = "cn=username,cn=Recipients,ou=Location,o=Company"; my $password = "topSecret"; my $version = 3; # connect to server my $c = Net::LDAP->new($server, port=>$port); die "Error: couldn't connect: $@\n" unless ($c){ # try to bind as user my $mesg = $c->bind( $user, password => $password, version => $version); if ($mesg->code()){ # on error # get errormessages my $errorCode = $mesg->code; my $errorText = ldap_error_text($mesg->code); my $errorMsg = ldap_error_name($mesg->code); $c->Disconnect(); die <<EOD; Error in bind: Code: $errorCode Message: $errorMsg Text: $errorText EOD ;

    Best regards,
    perl -le "s==*F=e=>y~\*martinF~stronat~=>s~[^\w]~~g=>chop,print"

Re: Accessing MailBox's from Exchange Server by LDAP
by Fletch (Bishop) on Apr 11, 2002 at 17:18 UTC

    LDAP is a directory access protocol, not a mail protocol. You'd probably have better luck using IMAP or POP3 (presuming that your M$ admins have turned that on). See Net::IMAP or Net::POP3.