[Mimedefang] OT: Validing email address in Exchange
    Graham Dunn 
    gdunn at inscriber.com
       
    Mon Nov 24 16:58:12 EST 2003
    
    
  
On Mon, Nov 24, 2003 at 10:07:25AM -0500, Ray Parish wrote:
> Sorry for the OT:
> Figured some of you all are using mimedefang in front of your
> Exchange enviroment and perhaps have the same issue.
> 
> I would like to configure sendmail using LDAP to check the validity
> of an email before accepting the message.
> I know sendmail can make the LDAP calls, just a little stumped at
> the ldap search query that needs to be preformed.
----
#!/usr/bin/perl -w
··
use strict;
use Net::LDAP;
··
my $ldap=Net::LDAP->new('my.exchange.server') or die "$@";
$ldap->bind;
my $mesg=$ldap->search(base=>"o=My Organizational Name",
                       filter=> "(&(mail=*)(otherMailbox=smtp\$$ARGV[0]*))",
»·······»·······»·······attrs => ['otherMailbox']
                        );
$mesg->code && die $mesg->error;
                        
foreach my $entry ($mesg->all_entries) {
        $entry->dump;
}
$ldap->unbind;
----
Will get you something back like:
gdunn at shizuka ~ %./test-ldap2.pl grahamd at inscriber.com
~
------------------------------------------------------------------------
dn:cn=GrahamD,cn=Recipients,ou=DEV,o=My Organizational Name
otherMailbox: CCMAIL$Dunn, Graham at DEV
              MS$INSCRIBERT/DEV/GRAHAMD
              smtp$Graham at inscriber.com
              smtp$grahamd at imagenorth.com
              smtp$GrahamD at inscriber.com
              smtp$hup at inscriber.com
              smtp$mimedefang at inscriber.com
              smtp$mslicensing at inscriber.com
              smtp$nsi-admin at inscriber.com
              smtp$root at inscriber.com
I'm working on a more robust version of the script now.
Graham
    
    
More information about the MIMEDefang
mailing list