Add contacts from external address books

If you integrate WebMail with your application, and that application has address book of some kind, you might want to have those addresses used by WebMail.

The plugin affects address autocompletion when composing mails and filling in To, CC or BCC fields.

Upon downloading and extracting plugin package, rename its main directory from:

plugin-add-suggest-contacts-example-master

to:

add-suggest-contacts-example

Then you'll need to deploy the plugin so that its index file is available at the following location:

data/plugins/add-suggest-contacts-example/index.php

To enable the plugin, add the following to array defined in data/settings/config.php file:

'plugins.add-suggest-contacts-example' => true, 

In the plugin code, you'll need to supply the actual code for fetching contacts from your application or contacts storage. The actual code must overwrite pseudo-code supplied there:

$oRemoteDb = CRemoteApi::GetDB();
$aResultContacts = $oRemoteDb->GetContacts($oAccount->Email, $sSearch);

$oAccount->Email is email address of current user, $sSearch is a search pattern entered in address line, your code should probably consider both the parameters when fetching matching addresses.

Plugin merges autocompletion suggestions generated by WebMail with those fetched from external system. However, it doesn't cover removing duplicates and trimming list if it gets too long, you'll need to do that in your custom code supplied within the plugin.