Author Topic: Multiple Email Addresses For a Contact  (Read 6624 times)

Offline dloendorf

  • Jr. Member
  • **
  • Posts: 16
Multiple Email Addresses For a Contact
« on: October 08, 2007, 06:22:09 PM »
The update code listed below will let you have up to four email addresses for each contact. You should note that the line numbers are based on the fact you have updated RC per an earlier post to support advanced contact information. If you have not, then the updates will still work - you will have to find the right lines to update.

Update code to add multiple email addresses for each contact:
Code: [Select]
# -------------------------------------------------------------------------------------------------------------
#
# In file /program/include/rcube_contacts.inc
#
# Replace Line 31 with
 var $table_cols = array('name', 'firstname', 'surname', 'email', 'email2', 'email3', 'email4', 'global_contact', 'firm', 'position', 'p_tel', 'p_fax', 'p_mob', 'p_address', 'w_tel', 'w_fax', 'w_mob', 'w_address', 'notice');
#
#NOTE: If you have not updated this file to include enhanced contacts and global contact
# then just add the string 'email2', 'email3', 'email4', immedialely after the string 'email', on line 31.
#
# -------------------------------------------------------------------------------------------------------------
#
# In file /program/steps/mail/compose.inc
#
# Replace Line 877 with
 while ($sql_arr = $result->iterate()){
#
# Insert the following lines after Line 879
  if ($sql_arr['email2'])
   $a_contacts[] = format_email_recipient($sql_arr['email2'], JQ($sql_arr['name']));
  if ($sql_arr['email3'])
   $a_contacts[] = format_email_recipient($sql_arr['email3'], JQ($sql_arr['name']));
  if ($sql_arr['email4'])
   $a_contacts[] = format_email_recipient($sql_arr['email4'], JQ($sql_arr['name']));
}
#
# -------------------------------------------------------------------------------------------------------------
#
# In File /program/localization/en_US/label.inc
# Insert after line 163
$labels['email2']  = 'E-Mail 2';
$labels['email3']  = 'E-Mail 3';
$labels['email4']  = 'E-Mail 4';
#
# -------------------------------------------------------------------------------------------------------------
#
# In file /program/steps/addressbook/edit.inc
# Replace Line 64 with
 $a_show_cols = array('name', 'firstname', 'surname', 'global_contact', 'email', 'email2', 'email3', 'email4', 'firm', 'position', 'p_tel', 'p_fax', 'p_mob', 'p_address', 'w_tel', 'w_fax', 'w_mob', 'w_address', 'notice');
#
#NOTE: If you have not updated this file to include enhanced contacts and global contact
# then just add the string 'email2', 'email3', 'email4', immedialely after the string 'email', on line 64.
#
# -------------------------------------------------------------------------------------------------------------
#
# In file /program/steps/addressbook/show.inc
# Replace Line 49 with
 $a_show_cols = array('name', 'firstname', 'surname', 'email', 'email2', 'email3', 'email4', 'global_contact', 'firm', 'position', 'p_tel', 'p_fax', 'p_mob', 'p_address', 'w_tel', 'w_fax', 'w_mob', 'w_address', 'notice');
#
#NOTE: If you have not updated this file to include enhanced contacts and global contact
# then just add the string 'email2', 'email3', 'email4', immedialely after the string 'email', on line 49.
#
# Replace Line 52 (or the one that begins with if (($col=='email'...) with
  if (($col=='email' || $col=='email2' || $col=='email3' || $col=='email4') && !empty($record[$col]))
#
# -------------------------------------------------------------------------------------------------------------
#
# In file /program/steps/addressbook/save.inc
# Replace Line 40 with
$a_save_cols = array('name', 'firstname', 'surname', 'email', 'email2', 'email3', 'email4', 'global_contact', 'firm', 'position', 'p_tel', 'p_fax', 'p_mob', 'p_address', 'w_tel', 'w_fax', 'w_mob', 'w_address', 'notice');
#
#NOTE: If you have not updated this file to include enhanced contacts and global contact
# then just add the string 'email2', 'email3', 'email4', immedialely after the string 'email', on line 40.
#
# -------------------------------------------------------------------------------------------------------------
#

# Database Additions for contact multiple emails
# Run in PhpMyAdmin on the database that holds the RC Contacts table. Change the table name rc_contacts to your contacts table name:
#

 ALTER TABLE `rc_contacts` ADD `email2` VARCHAR(128) NOT NULL ;
 ALTER TABLE `rc_contacts` ADD `email3` VARCHAR(128) NOT NULL ;
 ALTER TABLE `rc_contacts` ADD `email4` VARCHAR(128) NOT NULL ;

David

Offline Rudy

  • Jr. Member
  • **
  • Posts: 17
Re: Multiple Email Addresses For a Contact
« Reply #1 on: October 09, 2007, 12:57:51 AM »
Awesome!! THANKS! Works great! :D

Offline mishoddt

  • Jr. Member
  • **
  • Posts: 11
Multiple Email Addresses For a Contact
« Reply #2 on: January 12, 2010, 06:10:45 PM »
Hello!

Anyone has this working on 0.3.1? If yes, please, post the details.

Thanks!