Search The ForumSearch   RegisterRegister  LoginLogin

AfterLogic WebMail Lite 7

 AfterLogic Forum : AfterLogic WebMail Lite 7
Subject Topic: Insert contact from Data base Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
dikodhiko
Newbie
Newbie
Avatar

Joined: 24 February 2016
Location: Indonesia
Online Status: Offline
Posts: 0
Posted: 15 March 2016 at 9:17pm | IP Logged Quote dikodhiko

Hi Everyone,

anyone now how to insert contact for everyone from database?

i have trying to to insert contact from table awm_addr_book,
if i using webmail pro all contact can be place on my account.

but if i trying to use webmail lite no one contact place on my account.

any solution using wb lite?

thanks.
Back to Top View dikodhiko's Profile Search for other posts by dikodhiko
 
rsantellan
Newbie
Newbie


Joined: 14 October 2015
Online Status: Offline
Posts: 11
Posted: 15 March 2016 at 9:22pm | IP Logged Quote rsantellan

You can use this: http://www.afterlogic.com/aurora/docs/api/class-CApiContactsManager.html#_createContact

Or this: http://www.afterlogic.com/wiki/Add_contacts_from_external_address_books_%28WebMail_Plugins%29?WM=Lite

Both works like a charm!
Back to Top View rsantellan's Profile Search for other posts by rsantellan
 
dikodhiko
Newbie
Newbie
Avatar

Joined: 24 February 2016
Location: Indonesia
Online Status: Offline
Posts: 0
Posted: 15 March 2016 at 10:17pm | IP Logged Quote dikodhiko

rsantellan wrote:
You can use this: http://www.afterlogic.com/aurora/docs/api/class-CApiContactsManager.html#_createContact

Or this: http://www.afterlogic.com/wiki/Add_contacts_from_external_address_books_%28WebMail_Plugins%29?WM=Lite

Both works like a charm!


i have try to use this :

http://www.afterlogic.com/wiki/Add_contacts_from_external_address_books_%28W
ebMail_Plugins%29?WM=Lite

but i dont know to how to connect to my database bellow this command :
// Your custom php logic
can u give me example code you use? :(
Back to Top View dikodhiko's Profile Search for other posts by dikodhiko
 
rsantellan
Newbie
Newbie


Joined: 14 October 2015
Online Status: Offline
Posts: 11
Posted: 15 March 2016 at 10:21pm | IP Logged Quote rsantellan

Code:

if ($oAccount)
          {
               // Your custom php logic
                        $pdo = CApi::GetPDO();
                        $sql = 'select c.name, ce.contact_id, ce.email, ce.tipo from contactos_emails ce inner join contactos c on c.id = ce.contact_id where ce.email like :email';
                        $stmt = $pdo->prepare($sql);
                        $stmt->execute(array('email' => '%'.$sSearch.'%'));
                        while($row = $stmt->fetch()) {
                                $oContac tItem = new CContactListItem();
                                $oContac tItem->Id = 0;
                                $oContac tItem->IdStr = '';
                                $oContac tItem->Name = $row['name'].' ('.$row['tipo'].')';
                                $oContac tItem->Email = $row['email'];
                                $oContac tItem->UseFriendlyName = true;
                                $oContac tItem->Global = true;
                                $oContac tItem->ReadOnly = true;
                                $oContac tItem->ItsMe = $oContactItem->Email === $oAccount->Email;

                                $aList[] = $oContactItem;
                        }
          }


Hope it helps!!

Regards.
Rodrigo
Back to Top View rsantellan's Profile Search for other posts by rsantellan
 
dikodhiko
Newbie
Newbie
Avatar

Joined: 24 February 2016
Location: Indonesia
Online Status: Offline
Posts: 0
Posted: 15 March 2016 at 11:16pm | IP Logged Quote dikodhiko

rsantellan wrote:
Code:

if ($oAccount)
          {
               // Your custom php logic
                        $pdo = CApi::GetPDO();
                        $sql = 'select c.name, ce.contact_id, ce.email, ce.tipo from contactos_emails ce inner join contactos c on c.id = ce.contact_id where ce.email like :email';
                        $stmt = $pdo->prepare($sql);
                        $stmt->execute(array('email' => '%'.$sSearch.'%'));
                        while($row = $stmt->fetch()) {
                                 $o Contac tItem = new CContactListItem();
                                 $o Contac tItem->Id = 0;
                                 $o Contac tItem->IdStr = '';
                                 $o Contac tItem->Name = $row['name'].' ('.$row['tipo'].')';
                                 $o Contac tItem->Email = $row['email'];
                                 $o Contac tItem->UseFriendlyName = true;
                                 $o Contac tItem->Global = true;
                                 $o Contac tItem->ReadOnly = true;
                                 $o Contac tItem->ItsMe = $oContactItem->Email === $oAccount->Email;

                                $aList[] = $oContactItem;
                        }
          }


Hope it helps!!

Regards.
Rodrigo


Very thanks for that buddy,

are u using windwos server and sql db?
im using centos 7 and mysql db. :)

thanks,

you are awesome.
Back to Top View dikodhiko's Profile Search for other posts by dikodhiko
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide