[imp] Multiple email address for an LDAP contact
Alex Masidlover
alex.masidlover at zednax.com
Mon Sep 11 13:39:47 PDT 2006
This issue has been reported on the Turba list, but really it is an
IMP issue rather than a Turba issue. Where a contact has multiple
email addresses (in our case stored in LDAP backends) IMP will expand
the contact as:
<NAME>: <email1>, <email2>, <email3>
Which as Jan pointed out to the poster on the Turba list will be
understood by SMTP servers - however, I have contacts who I have
personal, work, mobile addresses etc. for who would not appreciate a
copy of every message to every address!
From my point of view the ideal would be for the expand names
function to show the different addresses in the drop down (in the same
way as ambiguous names). Obviously this doesn't help when browsing the
address book but it is a start...
Anyway, I have written a little mod that achieves the above, it is at
the end of this mail (diffed against IMP4.1 stable). Apologies if my
PHP style is poor, but this is the first new PHP code I've ever written!
Regards,
Alex Masidlover
Zednax Limited
http://www.zednax.com and http://www.axiomtech.co.uk
401,422d400
<
< /* Split results with multiple email address. */
< $keys = array_keys($results);
< foreach ($keys as $key) {
< $subTotal = count($results[$key]);
< for ($i = 0; $i < $subTotal; ++$i) {
< $new_results = array();
< $email_addresses = explode(", ", $results[$key][$i]['email']);
< if(count($email_addresses) > 1) {
< foreach ($email_addresses as $emailtmp) {
< $mytmp = $results[$key][$i];
< $mytmp['email'] = $emailtmp;
< array_push($new_results, $mytmp);
< }
< unset($results[$key][$i]);
< foreach ($new_results as $new_result) {
< array_push($results[$key], $new_result);
< }
< }
<
< }
< }
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
More information about the imp
mailing list