If you don't find the address you're looking for in "mail", then prefix "smtp:" 
(lowercase) to the value of $email.  (The SMTP: address IS the address in "mail".)

i.e.

        (proxyaddresses=smtp:$email) 

And usually there isn't any need to try twice... just "OR" the filter:

        (|(mail=$email)(proxyaddresses=smtp:$email))

since both attributes are probably indexed.  (This looks like it applies to Active 
Directory or Exchange 5.5... the X400 address in proxyaddresses is the hint)

---
Rick Tatem
SAS Institute Inc.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, June 01, 2004 9:15 AM
To: [EMAIL PROTECTED]
Subject: Net::LDAP filter question

Greetings,

        I am having a bit of a problem understanding the filtering stuff for 
Net::LDAP.  Here is my situation...

Presently we do:
# Search for user
$mesg = $ldap->search(base => $base_dn,
                       scope => 'sub',
                       filter => "(mail=$email)");


$email => the email address the incoming message is sent to (IE
[EMAIL PROTECTED]) and the filter looks for an LDAP field called "mail"
which contains the value in $email.

If that fails, we need instead to look for the email address in the LDAP field 
"proxyAddresses", which is not a SINGLE field but instead has contents which look like 
this:
proxyAddresses: SMTP:[EMAIL PROTECTED]; smtp:[EMAIL PROTECTED]; smtp:[EMAIL 
PROTECTED]; X400:c=US;a= ;p=FLA;o=DOH;s=scancardrequest;; RFAX:MQA Scancard Requests@;

The trick is how to construct the query so it will look for the value of the $email 
string within the "proxyAddresses" LDAP field.

Any advise?

--
Stewart Larsen
Florida Department of Health, Information Technology Security HIRM, Mail Bin B05, Room 
230B
4052 Bald Cypress Way,
Tallahassee, FL 32399-1733
(850) 245-4444 x 3358

Please note: Florida has a very broad public records law.  Most written communications 
to or from state officials regarding state business are public records available to 
the public and media upon request. Your e-mail  communications may therefore be 
subject to public disclosure.


Reply via email to