RoundCube Webmail Forum  

Go Back   RoundCube Webmail Forum > SVN Releases > Requests

For more information about the ads and why they're here, please see the FAQ
Reply
  #1  
Old 08-02-2006, 12:31 AM
Registered User
 
Join Date: Jul 2006
Posts: 22
Downloads: 0
Uploads: 0
Default Compose to alternate email addresses

Following on from the previous address book extension post, I have made a small tweak that will allow me to send mail to an alternate email address for a contact. I have added another field "otheremail" to my contacts table, and as per instructions in the previous post I have also modified the address book code to allow access to this field when adding/modifying contacts.

There are probably other places to consider, but to simply add this alternate email address to my compose lists I modified program\steps\mail\compose.inc as follows:

Original compose.inc (from line 779)

Code:
/****** get contacts for this user and add them to client scripts ********/

$sql_result = $DB->query("SELECT name, email
             FROM ".get_table_name('contacts')." WHERE user_id=?
             AND del<>1",$_SESSION['user_id']);
                  
if ($DB->num_rows($sql_result))
 {    
 $a_contacts = array();
 while ($sql_arr = $DB->fetch_assoc($sql_result))
  if ($sql_arr['email'])
   $a_contacts[] = format_email_recipient($sql_arr['email'], rep_specialchars_output($sql_arr['name'], 'js'));
 
 $OUTPUT->add_script(sprintf("$JS_OBJECT_NAME.set_env('contacts', %s);", array2js($a_contacts)));
 }
Modified compose.inc (line 779)

Code:
/****** get contacts for this user and add them to client scripts ********/

$sql_result = $DB->query("SELECT name, email, otheremail
             FROM ".get_table_name('contacts')." WHERE user_id=?
             AND del<>1",$_SESSION['user_id']);
                  
if ($DB->num_rows($sql_result))
 {    
 $a_contacts = array();
 while ($sql_arr = $DB->fetch_assoc($sql_result)) {
  if ($sql_arr['email'])
   $a_contacts[] = format_email_recipient($sql_arr['email'], rep_specialchars_output($sql_arr['name'], 'js'));
  if ($sql_arr['otheremail'])
   $a_contacts[] = format_email_recipient($sql_arr['otheremail'], rep_specialchars_output($sql_arr['name'] . ' (2)', 'js'));
	 }
 
 $OUTPUT->add_script(sprintf("$JS_OBJECT_NAME.set_env('contacts', %s);", array2js($a_contacts)));
 }
This will add a contacts alternate email with a '(2)' after the name, as attached.

Cheers!!
Richard
Attached Images
File Type: png other1.png (1.4 KB, 1 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 08-05-2006, 10:07 AM
Super Moderator
 
Join Date: Jun 2006
Posts: 431
Downloads: 0
Uploads: 0
Send a message via ICQ to skaero Send a message via AIM to skaero Send a message via MSN to skaero Send a message via Yahoo to skaero
Default Re: Compose to alternate email addresses

I good idea, I don't know if I will use this but it has some good code!
__________________
[size=8pt]SKaero.com <br />&nbsp; [/size]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

For more information about the ads and why they're here, please see the FAQ

All times are GMT. The time now is 09:44 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright © 2006-2008 RoundCube Webmail Community