Accessing email database from other application

Discuss the Scalix Server software

Moderators: ScalixSupport, admin

IT@ORinc.

Accessing email database from other application

Postby IT@ORinc. » Thu Mar 23, 2006 5:23 pm

I am wondering if it's possible to access all the email adress on the Scalix Server from another application. I would like to create a list on our Intranet of all the email adresses we have on the server. I'm using PHP with odbc support on a linux (slackware 10.2) platform.

thank you in advance.

Matthieu

florian
Scalix
Scalix
Posts: 3852
Joined: Fri Dec 24, 2004 8:16 am
Location: Frankfurt, Germany
Contact:

Postby florian » Fri Mar 24, 2006 1:12 pm

Hi Mathieu,

odbc wouldn't really matter here as we don't put our stuff in sql databases - it's not the most efficient storage for our kind of data.

try an

Code: Select all

"omldapsearch -h localhost -p 389 -b o=Scalix '(objectClass=*)'


on your scalix server....so... by all means if it is your address book that you want to access, LDAP is the way to go. PHP has good support for LDAP access, I believe.

cheers,
F.
Florian von Kurnatowski, Die Harder!

burhankhalid
Posts: 137
Joined: Mon Dec 19, 2005 8:31 am

Postby burhankhalid » Tue Mar 28, 2006 7:51 am

Matthieu:

This should get you going. Disclaimer -- I am not a LDAP expert, so this might not be the most efficient way to get to this information. I was hacking away at getting a summary page to print all email addresses using PHP, and came up with this code to connect and get the email addresses.

Code: Select all

<?php
 
  $scalix_host = "localhost";
 
  $conn = ldap_connect($scalix_host);
  if (!$conn)
  {
     echo 'Could not connect to '.$scalix_host;
     die('ERR: CONNECT');
  }
 
  # Anonymous bind
  ldap_bind($conn);
 
  $dn = "o=Scalix";
  $mail_node = 'MY-COMPANY';

  $filter = '(|(objectClass=scalixPerson)(omMailnode='.$mail_node.'))';

  # Items you would like to pick out from the search query above
  $find = array('mail','rfc822Mailbox','omCn');

  $search_handle = ldap_search($conn,$dn,$filter,$find);
  $result = ldap_get_entries($conn,$search_handle);
 
  print_r($result);
?>


Return to “Scalix Server”



Who is online

Users browsing this forum: No registered users and 8 guests