diff --git a/addressbook/inc/class.addressbook_bo.inc.php b/addressbook/inc/class.addressbook_bo.inc.php index a260e2be2e..3574e66c8a 100755 --- a/addressbook/inc/class.addressbook_bo.inc.php +++ b/addressbook/inc/class.addressbook_bo.inc.php @@ -1461,7 +1461,7 @@ class addressbook_bo extends addressbook_so */ function link_query($pattern, Array &$options = array()) { - $filter = $result = $criteria = array(); + $result = $criteria = array(); $limit = false; if ($pattern) { @@ -1483,8 +1483,12 @@ class addressbook_bo extends addressbook_so $cfs = $this->read_customfields($ids); foreach($contacts as $contact) { - $result[$contact['id']] = $this->link_title($contact+(array)$cfs[$contact['id']]). - ($options['type'] === 'email' ? ' <'.$contact['email'].'>' : ''); + $result[$contact['id']] = $this->link_title($contact+(array)$cfs[$contact['id']]); + // make sure to return a correctly quoted rfc822 address, if requested + if ($options['type'] === 'email') + { + $result[$contact['id']] = imap_rfc822_write_address($contact['email'], '', $result[$contact['id']]); + } // show category color if ($contact['cat_id'] && ($color = etemplate::cats2color($contact['cat_id']))) { diff --git a/mail/inc/class.mail_compose.inc.php b/mail/inc/class.mail_compose.inc.php index dd2baad2e8..61d2d3bf58 100644 --- a/mail/inc/class.mail_compose.inc.php +++ b/mail/inc/class.mail_compose.inc.php @@ -3294,7 +3294,7 @@ class mail_compose { $contact['n_fn'] = str_replace(array(',','@'),' ',$contact['n_fn']); } - $completeMailString = trim($contact['n_fn'] ? $contact['n_fn'] : $contact['fn']) .' <'. trim($email) .'>'; + $completeMailString = imap_rfc822_write_address(trim($email), '', trim($contact['n_fn'] ? $contact['n_fn'] : $contact['fn'])); if(!empty($email) && in_array($completeMailString ,$results) === false) { $results[] = array( 'id'=>$completeMailString, @@ -3315,7 +3315,7 @@ class mail_compose { $group = $GLOBALS['egw']->accounts->read($g_id); if(!$group['account_email']) continue; - $completeMailString = trim($name) .' <'. trim($group['account_email']) .'>'; + $completeMailString = imap_rfc822_write_address(trim($group['account_email']), '', $name); $results[] = array( 'id' => $completeMailString, 'label' => $completeMailString,