[horde] Multiple Email Addresses To / From Activesync iOS Client - solution

Michael J Rubinsky mrubinsk at horde.org
Wed Jul 20 14:07:58 UTC 2011


Quoting Simon Wilson <simon at simonandkate.net>:

> On 20/07/2011, at 1:40 AM, Michael J Rubinsky <mrubinsk at horde.org> wrote:
>
>>
>> Quoting Simon Wilson <simon at simonandkate.net>:
>>
>>> OK, i have multiple email addresses working ActiveSync iPad ->  
>>> Turba -> SQL address book ok, just want to see if there is a  
>>> better way. Anyone else doing this out there?
>>>
>>> iOS stores up to three email addresses per contact -  
>>> email1address, email2address, and email3address.
>>>
>>> Initially googling and looking on bugs.horde.org seemed to point  
>>> to using 'emails' instead of 'email' from attributes.php and then  
>>> mapping 'emails' => 'object_email' in backends.local.php, but the  
>>> activesync driver expects to find 'email':
>>>
>>> if (!$message->isGhosted('email1address')) {
>>>            $hash['email'] =  
>>> Horde_Icalendar_Vcard::getBareEmail($message->email1address);
>>>
>>> The only difference between 'email' and 'emails' that I could see  
>>> was that one had allow_multi = true. So I tried setting 'email' to  
>>> allow_multi. But even with that set, you can't enter multiple  
>>> email addresses in Turba (form validation fails).
>>>
>>> A comment from here - http://bugs.horde.org/ticket/2660 - seemed  
>>> to indicate setting multiple email attributes all to object_email  
>>> in SQL, but that doesn't work, only the first one is set, the rest  
>>> just repeat it.
>>>
>>> Looking through the activesync driver in Horde, it shows some  
>>> SyncML options:
>>>
>>>       if (!$message->isGhosted('email2address')) {
>>>            $hash['homeEmail'] =  
>>> Horde_Icalendar_Vcard::getBareEmail($message->email2address);
>>>        }
>>>        if (!$message->isGhosted('email3address')) {
>>>            $hash['workEmail'] =  
>>> Horde_Icalendar_Vcard::getBareEmail($message->email3address);
>>>
>>> mapping email2address and email3address to homeEmail and workEmail  
>>> respectively.
>>
>> These have nothing to do with SyncML. They are mappings from  
>> ActiveSync properties to the Horde style attribute names.
>>
>>>
>>> These are defined in attributes.php like this:
>>>
>>> $attributes['workEmail'] = array(
>>>    'label' => _("Work Email"),
>>>    'type' => 'email',
>>>    'required' => false,
>>>    'params' => array('allow_multi' => false, 'strip_domain' =>  
>>> false, 'link_compose' => true)
>>> );
>>> $attributes['homeEmail'] = array(
>>>    'label' => _("Home Email"),
>>>    'type' => 'email',
>>>    'required' => false,
>>>    'params' => array('allow_multi' => false, 'strip_domain' =>  
>>> false, 'link_compose' => true)
>>> );
>>>
>>> What I have done is therefore in attributes.local.php modify those  
>>> slightly like this:
>>>
>>> $attributes['workEmail'] = array(
>>>    'label' => _("Email 3"),
>>>    'type' => 'email',
>>>    'required' => false,
>>>    'params' => array('allow_multi' => false, 'strip_domain' =>  
>>> false, 'link_compose' => true)
>>> );
>>>
>>> /* Mapped to activeSync Email2Address */
>>> $attributes['homeEmail'] = array(
>>>    'label' => _("Email 2"),
>>>    'type' => 'email',
>>>    'required' => false,
>>>    'params' => array('allow_multi' => false, 'strip_domain' =>  
>>> false, 'link_compose' => true)
>>> );
>>>
>>> And in backends.local.php I have:
>>>
>>>        'email' => 'object_email',
>>>        'homeEmail' => 'object_email2',
>>>        'workEmail' => 'object_email3',
>>>
>>> My "Tabs" are defined as:
>>>
>>>        _("Communications") => array('email', 'homeEmail',  
>>> 'workEmail', 'homePhone', 'workPhone',
>>>                                     'cellPhone', 'fax', 'pager'),
>>>
>>> And thus display as "Email", "Email 2", and "Email 3".
>>>
>>> In the SQL turba_objects table i created two new fields  
>>> object_email2 and object_email3.
>>>
>>> I also edited the search array in backends.local.php:
>>>
>>>    'search' => array(
>>>        'name',
>>>        'email',
>>>     'homeEmail',
>>>     'workEmail'
>>>    ),
>>>
>>> Now that all seems to work fine, syncs OK, and works in Turba.
>>>
>>> If anyone has any other better ways, please can you advise.
>>
>>
>> This is the recommended way of doing this...and is what I've posted  
>> a number of times to the mailing list. The only thing I would point  
>> out is that changing the label is not necessary, but will not  
>> affect anything else. Just be aware that some devices may label  
>> this differently.
>>
>>
>> --
>> mike
>
> Mike
>
> Is it worth putting it in the Horde wiki? I'm going to do a blog  
> entry but thought the wiki may be useful.

Sure. If there's not already a general HOWTO for enabling additional  
fields in Turba (since this isn't really specific to AS only), this  
would be useful.

> Thanks for the advice on labels too. We are all on iOS devices in  
> here and they just generically label them 'email'.

No problem, and thank _you_ for all the patience and testing the  
ActiveSync library :)

-- 
mike

The Horde Project (www.horde.org)
mrubinsk at horde.org



More information about the horde mailing list