From 0c6f4b88648879cf12342d16c83bdd0d3a11672f Mon Sep 17 00:00:00 2001 From: thomascube <thomas@roundcube.net> Date: Fri, 21 Mar 2008 09:29:12 -0400 Subject: [PATCH] Better patch to correctly quote email recipient strings (from #1484191) --- program/include/rcube_imap.inc | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/program/include/rcube_imap.inc b/program/include/rcube_imap.inc index 170e4a5..5b3efb8 100644 --- a/program/include/rcube_imap.inc +++ b/program/include/rcube_imap.inc @@ -2272,6 +2272,8 @@ { $a = $this->_parse_address_list($input, $decode); $out = array(); + // Special chars as defined by RFC 822 need to in quoted string (or escaped). + $special_chars = '[\(\)\<\>\\\.\[\]@,;:"]'; if (!is_array($a)) return $out; @@ -2285,7 +2287,7 @@ $address = $val['address']; $name = preg_replace(array('/^[\'"]/', '/[\'"]$/'), '', trim($val['name'])); if ($name && $address && $name != $address) - $string = sprintf('%s <%s>', preg_match('/[,;<>]/', $name) ? '"'.addcslashes($name, '"').'"' : $name, $address); + $string = sprintf('%s <%s>', preg_match("/$special_chars/", $name) ? '"'.addcslashes($name, '"').'"' : $name, $address); else if ($address) $string = $address; else if ($name) -- Gitblit v1.9.1