\documentclass{article}
\usepackage{ulem}
\pagestyle{headings}
\begin{document}
\section{How to Configure Turba to Display and Store up to 3 Email Addresses}
\subsection{Applies to: Turba 3/4 with a mySQL backend. }
This was driven by the need to store 3 email addresses in Turba to ActiveSync\footnote{http://example.com/index.php?page=ActiveSync} with Apple iOS and Android devices, which store up to 3 email addresses per contact.

The default SQL backend defined in backends.php defines only one email address:

\begin{verbatim}
'email' => 'object_email' 
\end{verbatim}

However this is made easier by the fact that turba/config/attributes.php defines multiple emails as follows:

\begin{verbatim}

/* Communication. */
$attributes['email'] = array(
    'label' => _("Email"),
    'type' => 'email',
    'required' => false,
    'params' => array('allow_multi' => false, 'strip_domain' => false, 'link_compose' => true)
);
$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)
);
\end{verbatim}

If you want them displayed with different names then create a 'turba/config/attributes.local.php' file (so your changes don't get overwritten in upgrades) and rename the 'label' entries, e.g.:

\begin{verbatim}

$attributes['workEmail'] = array(
    'label' => _("Email 3"),
    'type' => 'email',
    'required' => false,
    'params' => array('allow_multi' => false, 'strip_domain' => false, 'link_compose' => true)
);
\end{verbatim}

Next you will need somewhere to put those email addresses in your backend, and you will need to tell Turba about those places in your backend.

Turba 3: In backends.local.php map the extra email attributes to some new SQL fields:

\begin{verbatim}

'email' => 'object_email',
'homeEmail' => 'object_email2',
'workEmail' => 'object_email3',
\end{verbatim}

Turba 4: uncomment "homeEmail" and "workEmail" in backends.local.php

\begin{verbatim}

'email' => 'object_email',
'homeEmail' => 'object_homeemail',
'workEmail' => 'object_workemail',
\end{verbatim}

Turba 3: In mySQL create those extra fields - 'object\_email3' and 'object\_email2' as varchar(255) and add indexes to speed up searching. I use WebMin\footnote{http://example.com/index.php?page=WebMin} to manage my server, so adding them is all GUI based. You can of course use console 'mysql' commands, that's up to you!\newline
Turba 4: No need for creating extra fields, they are already there!

You now have storage for 3 email addresses in your backend, Turba has definitions for them, and knows where to store them. If you have tabs in your contacts display you will need to add the extra fields so they show up on the tab. My Communications tab is set up as follows:

\begin{verbatim}

_("Communications") => array('email', 'homeEmail', 'workEmail', 'homePhone', 'workPhone', 'cellPhone', 'fax', 'pager')
\end{verbatim}

I have relabelled mine so they show as "Email", "Email 2", and "Email 3".

You will also need to modify the search array in backends.local.php for the SQL data source:

\begin{verbatim}

'search' => array(
  'name',
  'email',
  'homeEmail',
  'workEmail'
),
\end{verbatim}

That will make those fields searchable so that Imp can autocomplete email addresses from them.

Hope that helps!

\end{document}
