Removed extra <> around RCPT TO addresses that made some mail-servers fail.
[squirrelmail.git] / functions / abook_ldap_server.php
index 8ed8e20acabc803d99809efb400c2b11818f7aac..57b4a43dc5375a559c65b41f948c3cb904cb8e04 100644 (file)
         else $surname = $this->charset_decode($row['sn'][0]);
 
         // Add one row to result for each e-mail address
-        for($j = 0 ; $j < $row['mail']['count'] ; $j++) {
-          array_push($ret, array('nickname'  => $nickname,
-                                 'name'      => $fullname,
-                                 'firstname' => $firstname,
-                                 'lastname'  => $surname,
-                                 'email'     => $row['mail'][$j],
-                                 'label'     => $label,
-                                 'phone'     => $phone,
-                                 'backend'   => $this->bnum,
-                                 'source'    => &$this->sname));
-
-          // Limit number of hits
-          $returned_rows++;
-          if(($returned_rows >= $this->maxrows) && 
-             ($this->maxrows > 0) ) {
-            ldap_free_result($sret);
-            return $ret;
-          }
-
-        }
+        if(isset($row['mail']['count'])) {
+          for($j = 0 ; $j < $row['mail']['count'] ; $j++) {
+            array_push($ret, array('nickname'  => $nickname,
+                                   'name'      => $fullname,
+                                   'firstname' => $firstname,
+                                   'lastname'  => $surname,
+                                   'email'     => $row['mail'][$j],
+                                   'label'     => $label,
+                                   'phone'     => $phone,
+                                   'backend'   => $this->bnum,
+                                   'source'    => &$this->sname));
+            
+            // Limit number of hits
+            $returned_rows++;
+            if(($returned_rows >= $this->maxrows) && 
+               ($this->maxrows > 0) ) {
+              ldap_free_result($sret);
+              return $ret;
+            }
+
+          } // for($j ...)
+
+        } // isset($row['mail']['count'])
+
        }
 
        ldap_free_result($sret);