6.0.0-alpha10
5/14/25

[#9554] store multiple email addresses as separate 'mail' attributes in LDAP
Summary store multiple email addresses as separate 'mail' attributes in LDAP
Queue Turba
Queue Version Git master
Type Enhancement
State Accepted
Priority 1. Low
Owners
Requester tgpfeiffer (at) web (dot) de
Created 01/30/2011 (5218 days ago)
Due
Updated 11/02/2016 (3115 days ago)
Assigned 02/01/2011 (5216 days ago)
Resolved
Milestone
Patch No

History
11/02/2016 09:42:40 PM oliverafg (at) gmx (dot) de Comment #6 Reply to this comment
1) The email form field always returns a single value, though we 
could of course split this up again, or add an option to return an 
array instead.
2) But more important, there isn't any way in Turba to store one 
field into several attributes. We do have composite fields, but 
these store in a *fixed* number of *different* attributes, not in a 
*variable* number of the *same* attribute. There is no 
infrastructure for that at all, so this is a larger undertaking.
Is this necessary at all?
As far as I can say, the emails (multi_value) field works fine with 
IMP and ActiveSync.

It works with ActiveSync in the expected way, the first three email 
addresses from emails are provided as email1, email2 and email3 to an 
activesync device and read this way from the device. (three email 
address are the limit of activesync)

this happens ins turba/lib/Driver.php at line 2690:
             case 'emails':
                 $address = 1;
                 foreach (explode(',', $value) as $email) {
                     while ($address <= 3 &&
                            $message->{'email' . $address . 'address'}) {
                         $address++;
                     }
                     if ($address > 3) {
                         break;
                     }
                     $message->{'email' . $address . 'address'} = $email;
                     $address++;
                 }
                 break;

A smiliar code snippet is there for vcards.

For LDAP I find the "array_merge" inside the _read function off 
Ldap.php. In funtion _write, there is nothing.

My suggestions:

1) generic version
at line 304:
if source is comma seperated array and target mutli value
for i in array ...
this one might be dangerous with other fields als children/child

2)
Or a hardcoded version just for "emails"
somehow ugly but works and no side effects

3)
in backends.local.php the opportunity/example for 2)

My php skills are just not good enough at the moment :(
07/07/2012 10:58:50 AM mehmet (at) giritli (dot) eu Comment #5 Reply to this comment
Seeing the first alpha releases of the horde apps, I was wondering if 
this is gonna be addressed in the next version or not. Multiple emails 
is a must for many many people I guess. Currently, it is the biggest 
limitation I have to live with when using horde....
07/01/2011 05:24:30 PM Jan Schneider Comment #4
Taken from Horde DevelopersHorde Developers
Version ⇒ Git master
Reply to this comment
The problem is that:
1) The email form field always returns a single value, though we could 
of course split this up again, or add an option to return an array 
instead.
2) But more important, there isn't any way in Turba to store one field 
into several attributes. We do have composite fields, but these store 
in a *fixed* number of *different* attributes, not in a *variable* 
number of the *same* attribute. There is no infrastructure for that at 
all, so this is a larger undertaking.
07/01/2011 05:20:11 PM Jan Schneider Type ⇒ Enhancement
State ⇒ Accepted
Priority ⇒ 1. Low
 
02/01/2011 09:10:03 AM Jan Schneider Assigned to Horde DevelopersHorde Developers
Priority ⇒ 2. Medium
State ⇒ Assigned
 
01/30/2011 05:20:56 PM tgpfeiffer (at) web (dot) de Comment #3 Reply to this comment
The behavior of using 'emails' is identical to using 'email' with 
'allow_multi'=true for me, i.e. multiple addresses get stored as a 
comma-separated string in the 'mail' attribute in LDAP.
01/30/2011 05:12:05 PM Jan Schneider State ⇒ Feedback
 
01/30/2011 05:11:57 PM Jan Schneider Comment #2 Reply to this comment
Try using the 'emails' instead of 'email' attribute.
01/30/2011 03:29:54 PM tgpfeiffer (at) web (dot) de Comment #1
Priority ⇒ 1. Low
Type ⇒ Bug
Summary ⇒ store multiple email addresses as separate 'mail' attributes in LDAP
Queue ⇒ Turba
Milestone ⇒
Patch ⇒ No
State ⇒ Unconfirmed
Reply to this comment
My Turba uses an LDAP backend, and I wondered how people could have 
more than one email address. Obviously, LDAP supports multiple 'mail' 
attributes per inetOrgPerson and when setting

   'allow_multi' => true

in turba/config/attributes.php, they are also treated as separate 
email addresses and each 'mail' entry results in a separate 
mailto-link in Turba.

However, when editing the email field, there is a comma-separated list 
of addresses which is written back into LDAP *as is*. This causes 
problems, because, for example, it's not possible any more to do an 
LDAP query with "(mail=address1@host.com)". Instead, the LDAP backend 
- just as it converts multiple 'mail' attribute values to a PHP array 
- should act the same when saving, i.e. converting the PHP array (or 
the comma-separated string) into multiple LDAP attributes.

Saved Queries