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

Simon Wilson simon at simonandkate.net
Tue Jul 19 14:39:00 UTC 2011


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 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.

Thanks
Simon.

--
Simon Wilson
M: 0400 12 11 16



More information about the horde mailing list